@@ -108,29 +108,25 @@ export class TeleportFragment extends VaporFragment {
108108 )
109109 } )
110110
111- const nodes = this . nodes
112111 // register updateCssVars to root fragments's update hooks so that
113112 // it will be called when root fragment changed
114113 if ( this . parentComponent && this . parentComponent . ut ) {
115- if ( isFragment ( nodes ) ) {
116- ; ( nodes . onUpdated || ( nodes . onUpdated = [ ] ) ) . push ( ( ) =>
117- updateCssVars ( this ) ,
118- )
119- } else if ( isVaporComponent ( nodes ) && isFragment ( nodes . block ) ) {
120- ; ( nodes . block . onUpdated || ( nodes . block . onUpdated = [ ] ) ) . push ( ( ) =>
121- updateCssVars ( this ) ,
122- )
123- } else if ( isArray ( nodes ) ) {
124- nodes . forEach ( node => {
125- if ( isFragment ( node ) ) {
126- ; ( node . onUpdated || ( node . onUpdated = [ ] ) ) . push ( ( ) =>
127- updateCssVars ( this ) ,
128- )
129- }
130- } )
131- }
114+ this . registerUpdateCssVars ( this . nodes )
132115 }
116+ }
133117
118+ private registerUpdateCssVars ( nodes : Block ) {
119+ if ( isFragment ( nodes ) ) {
120+ ; ( nodes . onUpdated || ( nodes . onUpdated = [ ] ) ) . push ( ( ) =>
121+ updateCssVars ( this ) ,
122+ )
123+ this . registerUpdateCssVars ( nodes . nodes )
124+ } else if ( isVaporComponent ( nodes ) ) {
125+ ; ( nodes . u || ( nodes . u = [ ] ) ) . push ( ( ) => updateCssVars ( this ) )
126+ this . registerUpdateCssVars ( nodes . block )
127+ } else if ( isArray ( nodes ) ) {
128+ nodes . forEach ( node => this . registerUpdateCssVars ( node ) )
129+ }
134130 if ( __DEV__ ) {
135131 if ( isVaporComponent ( nodes ) ) {
136132 nodes . parentTeleport = this
0 commit comments