Skip to content

Commit 4d0fa85

Browse files
committed
fix(async-stack): skip resolution if already timeouted
1 parent 951499f commit 4d0fa85

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/cuddly-glasses-visit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@svelte-put/async-stack': patch
3+
---
4+
5+
should skip resolution if has already timeouted

packages/async-stack/src/stack-item.svelte.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class StackItem {
5959
* @returns {Promise<Resolved | undefined>}
6060
*/
6161
resolve = async (resolved) => {
62-
if (this.state === 'resolved') return this.resolution;
62+
if (this.state === 'resolved' || this.state === 'timeout') return this.resolution;
6363
await Promise.all(this.#internals.resolveListeners.map((callback) => callback(resolved)));
6464
this.#internals.resolve(resolved);
6565
this.state = 'resolved';

0 commit comments

Comments
 (0)