Skip to content

Commit 91415bf

Browse files
committed
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.
1 parent 195aed1 commit 91415bf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/runtime/internal/scheduler.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,13 @@ export function flush() {
6969
render_callbacks.length = 0;
7070
} while (dirty_components.length);
7171

72-
set_current_component(saved_component);
73-
7472
while (flush_callbacks.length) {
7573
flush_callbacks.pop()();
7674
}
7775

7876
update_scheduled = false;
7977
seen_callbacks.clear();
78+
set_current_component(saved_component);
8079
}
8180

8281
function update($$) {

0 commit comments

Comments
 (0)