Skip to content

Commit 407213c

Browse files
committed
Don't need extra get_current_component variant
1 parent 86194eb commit 407213c

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/runtime/internal/lifecycle.ts

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ export function get_current_component() {
1111
return current_component;
1212
}
1313

14-
export function maybe_get_current_component() {
15-
return current_component;
16-
}
17-
1814
export function beforeUpdate(fn: () => any) {
1915
get_current_component().$$.before_update.push(fn);
2016
}

src/runtime/internal/scheduler.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { run_all } from './utils';
2-
import { maybe_get_current_component, set_current_component } from './lifecycle';
2+
import { current_component, set_current_component } from './lifecycle';
33

44
export const dirty_components = [];
55
export const intros = { enabled: false };
@@ -35,7 +35,7 @@ const seen_callbacks = new Set();
3535
let flushidx = 0; // Do *not* move this inside the flush() function
3636
export function flush() {
3737

38-
const current_component = maybe_get_current_component();
38+
const saved_component = current_component;
3939

4040
do {
4141
// first, call beforeUpdate functions
@@ -70,7 +70,7 @@ export function flush() {
7070
render_callbacks.length = 0;
7171
} while (dirty_components.length);
7272

73-
set_current_component(current_component);
73+
set_current_component(saved_component);
7474

7575
while (flush_callbacks.length) {
7676
flush_callbacks.pop()();

0 commit comments

Comments
 (0)