From 91415bf819112018db2a92cf0e0fe00091bc7be4 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 9 Dec 2021 10:33:12 +0700 Subject: [PATCH] Restore current component at end of function Since it's not necessary to restore the saved value of current_component before calling the flush_callbacks list, we'll move the restore to the very end of the function, which makes sense as saving it is the first thing the function does. --- src/runtime/internal/scheduler.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/runtime/internal/scheduler.ts b/src/runtime/internal/scheduler.ts index 6496500ccd..93496b84c1 100644 --- a/src/runtime/internal/scheduler.ts +++ b/src/runtime/internal/scheduler.ts @@ -69,14 +69,13 @@ export function flush() { render_callbacks.length = 0; } while (dirty_components.length); - set_current_component(saved_component); - while (flush_callbacks.length) { flush_callbacks.pop()(); } update_scheduled = false; seen_callbacks.clear(); + set_current_component(saved_component); } function update($$) {