diff --git a/incremental/runtime/src/states/State.ts b/incremental/runtime/src/states/State.ts index 7a437e911a5d198257114c969d7c899c11c54f67..2fd71226619d90dfedb4473b27532c485784b1b9 100644 --- a/incremental/runtime/src/states/State.ts +++ b/incremental/runtime/src/states/State.ts @@ -453,7 +453,8 @@ export /* Improve:HQ private as public*/ class StateImpl implements Obser manager.checkForStateDisposing() this.manager = undefined this.tracker = undefined - this.dependencies = this.dependencies?.clear() + this.dependencies?.clear() + this.dependencies = undefined manager.removeCreatedState(this, this.name) this.trackedScopes.clear() } @@ -615,7 +616,8 @@ class ParameterImpl implements StateEx, MutableState { if (manager === undefined) return // already disposed manager.checkForStateDisposing() this.manager = undefined - this.dependencies = this.dependencies?.clear() + this.dependencies?.clear() + this.dependencies = undefined } hasDependencies(): boolean { @@ -1325,8 +1327,10 @@ class ScopeImpl implements ManagedScope, IncrementalScope, Computa manager.checkForStateDisposing() let error: Error | undefined = undefined this.manager = undefined - this._states = this._states?.clear() - this.dependencies = this.dependencies?.clear() + this._states?.clear() + this._states = undefined + this.dependencies?.clear() + this.dependencies = undefined const scope = manager.current manager.current = this try { @@ -1394,7 +1398,8 @@ class ControlledScopeImpl implements Dependency, ControlledScope { static cleanup(scope?: ControlledScopeImpl): void { if (scope) { scope.manager = undefined - scope._states = scope._states?.clear() + scope._states?.clear() + scope._states = undefined } }