Skip to content

Commit 36612ab

Browse files
committed
use queue_micro_task in createSubscriber
1 parent b824473 commit 36612ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/svelte/src/reactivity/create-subscriber.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { effect_tracking, render_effect } from '../internal/client/reactivity/ef
33
import { source, increment } from '../internal/client/reactivity/sources.js';
44
import { tag } from '../internal/client/dev/tracing.js';
55
import { DEV } from 'esm-env';
6+
import { queue_micro_task } from '../internal/client/dom/task.js';
67

78
/**
89
* Returns a `subscribe` function that, if called in an effect (including expressions in the template),
@@ -68,7 +69,7 @@ export function createSubscriber(start) {
6869
subscribers += 1;
6970

7071
return () => {
71-
queueMicrotask(() => {
72+
queue_micro_task(() => {
7273
// Only count down after a microtask, else we would reach 0 before our own render effect reruns,
7374
// but reach 1 again when the tick callback of the prior teardown runs. That would mean we
7475
// re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.

0 commit comments

Comments
 (0)