Skip to content

Commit 1ab675f

Browse files
committed
fix: flush batches whenever an async value resolves
1 parent acdd930 commit 1ab675f

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

.changeset/metal-parents-train.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: flush batches whenever an async value resolves

packages/svelte/src/internal/client/reactivity/batch.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -375,21 +375,17 @@ export class Batch {
375375
decrement() {
376376
this.#pending -= 1;
377377

378-
if (this.#pending === 0) {
379-
for (const e of this.#dirty_effects) {
380-
set_signal_status(e, DIRTY);
381-
schedule_effect(e);
382-
}
383-
384-
for (const e of this.#maybe_dirty_effects) {
385-
set_signal_status(e, MAYBE_DIRTY);
386-
schedule_effect(e);
387-
}
378+
for (const e of this.#dirty_effects) {
379+
set_signal_status(e, DIRTY);
380+
schedule_effect(e);
381+
}
388382

389-
this.flush();
390-
} else {
391-
this.deactivate();
383+
for (const e of this.#maybe_dirty_effects) {
384+
set_signal_status(e, MAYBE_DIRTY);
385+
schedule_effect(e);
392386
}
387+
388+
this.flush();
393389
}
394390

395391
/** @param {() => void} fn */

0 commit comments

Comments
 (0)