File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,6 @@ export class EffectScope {
21
21
* removal
22
22
*/
23
23
private index : number | undefined
24
- /**
25
- * activeEffectScope in context not died should be recorded
26
- */
27
- private aliveEffectScope : EffectScope | undefined
28
24
29
25
constructor ( detached = false ) {
30
26
if ( ! detached && activeEffectScope ) {
@@ -38,27 +34,24 @@ export class EffectScope {
38
34
39
35
run < T > ( fn : ( ) => T ) : T | undefined {
40
36
if ( this . active ) {
37
+ const currentEffectScope = activeEffectScope
41
38
try {
42
- this . aliveEffectScope = activeEffectScope
43
39
activeEffectScope = this
44
40
return fn ( )
45
41
} finally {
46
- activeEffectScope = this . aliveEffectScope
47
- delete this . aliveEffectScope
42
+ activeEffectScope = currentEffectScope
48
43
}
49
44
} else if ( __DEV__ ) {
50
45
warn ( `cannot run an inactive effect scope.` )
51
46
}
52
47
}
53
48
54
49
on ( ) {
55
- this . aliveEffectScope = activeEffectScope
56
50
activeEffectScope = this
57
51
}
58
52
59
53
off ( ) {
60
- activeEffectScope = this . aliveEffectScope
61
- delete this . aliveEffectScope
54
+ activeEffectScope = this . parent
62
55
}
63
56
64
57
stop ( fromParent ?: boolean ) {
You can’t perform that action at this time.
0 commit comments