File tree Expand file tree Collapse file tree 4 files changed +16
-21
lines changed
Expand file tree Collapse file tree 4 files changed +16
-21
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,17 @@ export class EffectScope implements ReactiveNode {
7373 return
7474 }
7575 this . flags = EffectFlags . STOP
76+ this . reset ( )
77+ const sub = this . subs
78+ if ( sub !== undefined ) {
79+ unlink ( sub )
80+ }
81+ }
82+
83+ /**
84+ * @internal
85+ */
86+ reset ( ) : void {
7687 let dep = this . deps
7788 while ( dep !== undefined ) {
7889 const node = dep . dep
@@ -83,17 +94,6 @@ export class EffectScope implements ReactiveNode {
8394 dep = unlink ( dep , this )
8495 }
8596 }
86- const sub = this . subs
87- if ( sub !== undefined ) {
88- unlink ( sub )
89- }
90- this . cleanup ( )
91- }
92-
93- /**
94- * @internal
95- */
96- cleanup ( ) : void {
9797 cleanup ( this )
9898 }
9999}
Original file line number Diff line number Diff line change @@ -592,8 +592,7 @@ export class VaporComponentInstance<
592592 asyncDep : Promise < any > | null
593593 asyncResolved : boolean
594594
595- // for HMR and vapor custom element
596- // all render effects associated with this instance
595+ // for vapor custom element
597596 renderEffects ?: RenderEffect [ ]
598597
599598 hasFallthrough : boolean
Original file line number Diff line number Diff line change @@ -19,14 +19,10 @@ export function hmrRerender(instance: VaporComponentInstance): void {
1919 const normalized = normalizeBlock ( instance . block )
2020 const parent = normalized [ 0 ] . parentNode !
2121 const anchor = normalized [ normalized . length - 1 ] . nextSibling
22- // cleanup scope, ensure child components are unregister hmr and unmount
23- instance . scope . cleanup ( )
22+ // reset scope to avoid stale effects
23+ instance . scope . reset ( )
2424 remove ( instance . block , parent )
2525 const prev = setCurrentInstance ( instance )
26- if ( instance . renderEffects ) {
27- instance . renderEffects . forEach ( e => e . stop ( ) )
28- instance . renderEffects = [ ]
29- }
3026 pushWarningContext ( instance )
3127 devRender ( instance )
3228 popWarningContext ( )
Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ export class RenderEffect extends ReactiveEffect {
4444 : void 0
4545 }
4646
47- if ( __DEV__ || instance . type . ce ) {
48- // register effect for stopping them during HMR rerender
47+ // register effect for vapor custom element update
48+ if ( instance . type . ce ) {
4949 ; ( instance . renderEffects || ( instance . renderEffects = [ ] ) ) . push ( this )
5050 }
5151 job . i = instance
You can’t perform that action at this time.
0 commit comments