Skip to content

Commit ab740c9

Browse files
committed
Merge branch 'async-fixes' into async-fixes-2
2 parents 23b44ce + 9e54e9a commit ab740c9

File tree

1 file changed

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

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,14 @@ export function flushSync(fn) {
472472
batch.flush();
473473
}
474474

475-
// this would be reset in `batch.flush_effects()` but since we are early returning here,
476-
// we need to reset it here as well in case the first time there's 0 queued root effects
477-
last_scheduled_effect = null;
475+
// TODO this feels wrong
476+
if (queued_root_effects.length === 0) {
477+
// this would be reset in `batch.flush_effects()` but since we are early returning here,
478+
// we need to reset it here as well in case the first time there's 0 queued root effects
479+
last_scheduled_effect = null;
478480

479-
return /** @type {T} */ (result);
481+
return /** @type {T} */ (result);
482+
}
480483
}
481484

482485
batch.flush_effects();

0 commit comments

Comments
 (0)