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

Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
pull/15844/head
Rich Harris 3 months ago committed by GitHub
parent 89b93a1e4f
commit 4757b1b2a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -70,7 +70,7 @@ export function createSubscriber(start) {
return () => {
queueMicrotask(() => {
// Only count down after timeout, else we would reach 0 before our own render effect reruns,
// Only count down after a microtask, else we would reach 0 before our own render effect reruns,
// but reach 1 again when the tick callback of the prior teardown runs. That would mean we
// re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.
subscribers -= 1;

Loading…
Cancel
Save