File tree Expand file tree Collapse file tree 3 files changed +18
-14
lines changed
Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -149,14 +149,14 @@ export class ReactiveEffect<T = any>
149149 }
150150
151151 stop ( ) : void {
152- const sub = this . subs
153- if ( sub !== undefined ) {
154- unlink ( sub )
155- }
156152 let dep = this . deps
157153 while ( dep !== undefined ) {
158154 dep = unlink ( dep , this )
159155 }
156+ const sub = this . subs
157+ if ( sub !== undefined ) {
158+ unlink ( sub )
159+ }
160160 this . flags = 0
161161 cleanup ( this )
162162 }
Original file line number Diff line number Diff line change @@ -69,14 +69,20 @@ export class EffectScope implements ReactiveNode {
6969 }
7070
7171 stop ( ) : void {
72+ let dep = this . deps
73+ while ( dep !== undefined ) {
74+ const node = dep . dep
75+ if ( 'stop' in node ) {
76+ dep = dep . nextDep
77+ node . stop ( )
78+ } else {
79+ dep = unlink ( dep , this )
80+ }
81+ }
7282 const sub = this . subs
7383 if ( sub !== undefined ) {
7484 unlink ( sub )
7585 }
76- let dep = this . deps
77- while ( dep !== undefined ) {
78- dep = unlink ( dep , this )
79- }
8086 this . flags = 0
8187 cleanup ( this )
8288 }
Original file line number Diff line number Diff line change @@ -128,12 +128,10 @@ export function unlink(
128128 prevSub . nextSub = nextSub
129129 } else if ( ( dep . subs = nextSub ) === undefined ) {
130130 let toRemove = dep . deps
131- while ( toRemove !== undefined ) {
132- toRemove = unlink ( toRemove , dep )
133- }
134- if ( 'stop' in dep ) {
135- dep . stop ( )
136- } else {
131+ if ( toRemove !== undefined ) {
132+ do {
133+ toRemove = unlink ( toRemove , dep )
134+ } while ( toRemove !== undefined )
137135 dep . flags |= ReactiveFlags . Dirty
138136 }
139137 }
You can’t perform that action at this time.
0 commit comments