Skip to content

Commit ef964f2

Browse files
committed
run immediately after async derived resolves (#16497)
1 parent 01fc47d commit ef964f2

File tree

1 file changed

+7
-0
lines changed
  • packages/svelte/src/internal/client/reactivity

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ export function async_derived(fn, location) {
184184
if (should_suspend) {
185185
boundary.update_pending_count(-1);
186186
if (!pending) batch.decrement();
187+
} else {
188+
// Ensure effects depending on this async derived run promptly when we didn't suspend
189+
// and there is no pending boundary — commit queued work immediately.
190+
if (!pending) {
191+
batch.flush();
192+
batch.deactivate();
193+
}
187194
}
188195

189196
unset_context();

0 commit comments

Comments
 (0)