Visualize Your Ideas With Code
fix(core): clear DependencyContext promises once resolved (#617)
someguythatcodes97b68dabfdf8
diff --git a/packages/core/src/signals/DependencyContext.ts b/packages/core/src/signals/DependencyContext.tsindex be184347..242e074c 100644--- a/packages/core/src/signals/DependencyContext.ts+++ b/packages/core/src/signals/DependencyContext.ts@@ -35,19 +35,21 @@ export class DependencyContext<TOwner = void>if (context) {handle.owner = context.owner;}- promise.then(value => {- handle.value = value;- context?.markDirty();- });+ promise+ .then(value => {+ handle.value = value;+ context?.markDirty();+ })+ .finally(() => {+ this.promises = this.promises.filter(v => v !== handle);+ });this.promises.push(handle);return handle;}public static consumePromises(): PromiseHandle<any>[] {- const result = this.promises;- this.promises = [];- return result;+ return this.promises;}protected readonly invokable: any;