Skip to content

Commit 36a9059

Browse files
committed
no idea what a 'boundary micro task' is or why it was deemed necessary but evidently it isn't
1 parent 70a01fc commit 36a9059

File tree

1 file changed

+4
-29
lines changed
  • packages/svelte/src/internal/client/dom

1 file changed

+4
-29
lines changed

packages/svelte/src/internal/client/dom/task.js

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,13 @@ const request_idle_callback =
66
? (/** @type {() => void} */ cb) => setTimeout(cb, 1)
77
: requestIdleCallback;
88

9-
/** @type {Array<() => void>} */
10-
let boundary_micro_tasks = [];
11-
129
/** @type {Array<() => void>} */
1310
let micro_tasks = [];
1411

1512
/** @type {Array<() => void>} */
1613
let idle_tasks = [];
1714

18-
function run_boundary_micro_tasks() {
19-
var tasks = boundary_micro_tasks;
20-
boundary_micro_tasks = [];
21-
run_all(tasks);
22-
}
23-
24-
function run_post_micro_tasks() {
15+
function run_micro_tasks() {
2516
var tasks = micro_tasks;
2617
micro_tasks = [];
2718
run_all(tasks);
@@ -33,29 +24,13 @@ function run_idle_tasks() {
3324
run_all(tasks);
3425
}
3526

36-
function run_micro_tasks() {
37-
run_boundary_micro_tasks();
38-
run_post_micro_tasks();
39-
}
40-
41-
/**
42-
* @param {() => void} fn
43-
*/
44-
export function queue_boundary_micro_task(fn) {
45-
if (boundary_micro_tasks.length === 0 && micro_tasks.length === 0) {
46-
queueMicrotask(run_micro_tasks);
47-
}
48-
49-
// TODO do we need to differentiate between `boundary_micro_tasks` and `micro_tasks`?
50-
// nothing breaks if we push everything to `micro_tasks`
51-
boundary_micro_tasks.push(fn);
52-
}
27+
export { queue_micro_task as queue_boundary_micro_task };
5328

5429
/**
5530
* @param {() => void} fn
5631
*/
5732
export function queue_micro_task(fn) {
58-
if (boundary_micro_tasks.length === 0 && micro_tasks.length === 0) {
33+
if (micro_tasks.length === 0) {
5934
queueMicrotask(run_micro_tasks);
6035
}
6136

@@ -77,7 +52,7 @@ export function queue_idle_task(fn) {
7752
* Synchronously run any queued tasks.
7853
*/
7954
export function flush_tasks() {
80-
if (boundary_micro_tasks.length > 0 || micro_tasks.length > 0) {
55+
if (micro_tasks.length > 0) {
8156
run_micro_tasks();
8257
}
8358

0 commit comments

Comments
 (0)