File tree Expand file tree Collapse file tree 4 files changed +10
-11
lines changed
packages/runtime-vapor/src Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -402,7 +402,8 @@ export const createFor = (
402402 } else {
403403 oldBlocks = [ ]
404404 }
405- if ( frag . effects ) frag . effects . forEach ( effect => effect ( ) )
405+
406+ if ( frag . updated ) frag . updated . forEach ( m => m ( ) )
406407 setActiveSub ( prevSub )
407408 }
408409
Original file line number Diff line number Diff line change @@ -104,11 +104,11 @@ export class TeleportFragment extends VaporFragment {
104104 // updateCssVars will be called when subtree changed
105105 if ( this . parentComponent && this . parentComponent . ut ) {
106106 if ( isFragment ( nodes ) ) {
107- ; ( nodes . effects || ( nodes . effects = [ ] ) ) . push ( ( ) => updateCssVars ( this ) )
107+ ; ( nodes . updated || ( nodes . updated = [ ] ) ) . push ( ( ) => updateCssVars ( this ) )
108108 } else if ( isArray ( nodes ) ) {
109109 nodes . forEach ( node => {
110110 if ( isFragment ( node ) ) {
111- ; ( node . effects || ( node . effects = [ ] ) ) . push ( ( ) =>
111+ ; ( node . updated || ( node . updated = [ ] ) ) . push ( ( ) =>
112112 updateCssVars ( this ) ,
113113 )
114114 }
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ export class VaporFragment<T extends Block = Block>
5252 refKey : string | undefined ,
5353 ) => void
5454
55- // effects to run after fragment render
56- effects ?: ( ( ) => void ) [ ]
55+ // hooks
56+ updated ?: ( ( nodes ?: Block ) => void ) [ ]
5757
5858 constructor ( nodes : T ) {
5959 this . nodes = nodes
@@ -83,7 +83,6 @@ export class DynamicFragment extends VaporFragment {
8383 scope : EffectScope ,
8484 ) => boolean ) [ ]
8585 beforeMount ?: ( ( newKey : any , nodes : Block , scope : EffectScope ) => void ) [ ]
86- mounted ?: ( ( nodes : Block , scope : EffectScope ) => void ) [ ]
8786
8887 constructor ( anchorLabel ?: string ) {
8988 super ( [ ] )
@@ -192,15 +191,14 @@ export class DynamicFragment extends VaporFragment {
192191
193192 if ( parent ) {
194193 insert ( this . nodes , parent , this . anchor )
195- if ( this . mounted ) {
196- this . mounted . forEach ( hook => hook ( this . nodes , this . scope ! ) )
194+ if ( this . updated ) {
195+ this . updated . forEach ( hook => hook ( this . nodes ) )
197196 }
198197 }
199198 } else {
200199 this . scope = undefined
201200 this . nodes = [ ]
202201 }
203- if ( this . effects ) this . effects . forEach ( effect => effect ( ) )
204202 }
205203
206204 hydrate = ( isEmpty = false ) : void => {
Original file line number Diff line number Diff line change @@ -383,7 +383,7 @@ function createVDOMComponent(
383383 }
384384
385385 frag . nodes = vnode . el as any
386- if ( frag . effects ) frag . effects . forEach ( effect => effect ( ) )
386+ if ( frag . updated ) frag . updated . forEach ( m => m ( ) )
387387 }
388388
389389 frag . remove = unmount
@@ -450,7 +450,7 @@ function renderVDOMSlot(
450450 }
451451 }
452452
453- if ( frag . effects ) frag . effects . forEach ( effect => effect ( ) )
453+ if ( frag . updated ) frag . updated . forEach ( m => m ( ) )
454454 }
455455
456456 const render = ( parentNode ?: ParentNode , anchor ?: Node | null ) => {
You can’t perform that action at this time.
0 commit comments