|
|
@@ -34,9 +34,9 @@ export class EffectScope {
|
|
|
*/
|
|
|
private index: number | undefined
|
|
|
|
|
|
- constructor(detached = false) {
|
|
|
+ constructor(public detached = false) {
|
|
|
+ this.parent = activeEffectScope
|
|
|
if (!detached && activeEffectScope) {
|
|
|
- this.parent = activeEffectScope
|
|
|
this.index =
|
|
|
(activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
|
|
this
|
|
|
@@ -89,7 +89,7 @@ export class EffectScope {
|
|
|
}
|
|
|
}
|
|
|
// nested scope, dereference from parent to avoid memory leaks
|
|
|
- if (this.parent && !fromParent) {
|
|
|
+ if (!this.detached && this.parent && !fromParent) {
|
|
|
// optimized O(1) removal
|
|
|
const last = this.parent.scopes!.pop()
|
|
|
if (last && last !== this) {
|
|
|
@@ -97,6 +97,7 @@ export class EffectScope {
|
|
|
last.index = this.index!
|
|
|
}
|
|
|
}
|
|
|
+ this.parent = undefined
|
|
|
this.active = false
|
|
|
}
|
|
|
}
|