From b6164128b3ea823876fc9d14e8251befac6ff7bd Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 12 May 2025 15:51:05 -0400 Subject: [PATCH] chore: avoid microtasks when flushing sync (alternative) (#15895) * chore: avoid microtasks when flushing sync * chore: avoid microtasks when flushing sync * chore: avoid microtasks when flushing sync * tweak * WIP * another * more * tweak * fix * fix * belt and braces * Revert "belt and braces" This reverts commit f8de1cf47ade629347ae7087cbb7e5f5099d0758. --------- Co-authored-by: Dominic Gannaway --- .changeset/polite-melons-tickle.md | 5 +++++ packages/svelte/src/internal/client/runtime.js | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/polite-melons-tickle.md diff --git a/.changeset/polite-melons-tickle.md b/.changeset/polite-melons-tickle.md new file mode 100644 index 0000000000..42967ea936 --- /dev/null +++ b/.changeset/polite-melons-tickle.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +chore: avoid microtasks when flushing sync diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index 7a926bf624..2375dc0a63 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -823,6 +823,8 @@ export function flushSync(fn) { if (fn) { is_flushing = true; flush_queued_root_effects(); + + is_flushing = true; result = fn(); }