diff --git a/packages/svelte/src/internal/client/render.js b/packages/svelte/src/internal/client/render.js index 0a550cc522..51fe0fc043 100644 --- a/packages/svelte/src/internal/client/render.js +++ b/packages/svelte/src/internal/client/render.js @@ -28,7 +28,6 @@ import { } from './reconciler.js'; import { destroy_signal, - push_destroy_fn, untrack, flush_sync, push, @@ -1361,7 +1360,8 @@ export function bind_this(element_or_component, update, get_value, get_parts) { // Add effect teardown (likely causes: if block became false, each item removed, component unmounted). // In these cases we need to nullify the binding only if we detect that the value is still the same. // If not, that means that another effect has now taken over the binding. - push_destroy_fn(e, () => { + // TODO this is the only place we use this mechanism, see if we can get rid of it + e.y = () => { // Defer to the next tick so that all updates can be reconciled first. // This solves the case where one variable is shared across multiple this-bindings. effect(() => { @@ -1369,7 +1369,7 @@ export function bind_this(element_or_component, update, get_value, get_parts) { update(null, ...parts); } }); - }); + }; } /** diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index af04882b2d..8f80243f50 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -965,23 +965,6 @@ export function untrack(fn) { } } -/** - * @template V - * @param {import('#client').Effect} signal - * @param {() => void} destroy_fn - * @returns {void} - */ -export function push_destroy_fn(signal, destroy_fn) { - let destroy = signal.y; - if (destroy === null) { - signal.y = destroy_fn; - } else if (is_array(destroy)) { - destroy.push(destroy_fn); - } else { - signal.y = [destroy, destroy_fn]; - } -} - const STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN); /** * @template V