fix: wait a microtask for await blocks to reduce UI churn

pull/11989/head
Dominic Gannaway 2 years ago
parent 0427a4d423
commit dd9cca0d59

@ -6,7 +6,9 @@
"type": "module", "type": "module",
"license": "MIT", "license": "MIT",
"packageManager": "pnpm@9.2.0", "packageManager": "pnpm@9.2.0",
"engines": {
"pnpm": "^9.0.0"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/sveltejs/svelte.git" "url": "git+https://github.com/sveltejs/svelte.git"

@ -90,6 +90,8 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
try { try {
set_current_effect(parent_effect); set_current_effect(parent_effect);
set_current_reaction(parent_reaction); set_current_reaction(parent_reaction);
if (then_effect) pause_effect(then_effect);
if (catch_effect) pause_effect(catch_effect);
pending_effect = branch(() => pending_fn(anchor)); pending_effect = branch(() => pending_fn(anchor));
} finally { } finally {
set_current_effect(previous_effect); set_current_effect(previous_effect);
@ -105,9 +107,6 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
} }
} }
if (then_effect) pause_effect(then_effect);
if (catch_effect) pause_effect(catch_effect);
promise.then( promise.then(
(value) => { (value) => {
if (promise !== input) return; if (promise !== input) return;

Loading…
Cancel
Save