From ebf72beb73d7117a19bb5fd3e9649e6bbd4bfab3 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 2 Jul 2024 12:25:48 -0700 Subject: [PATCH] chore: default remove_dom to false (#12267) --- .../src/internal/client/reactivity/deriveds.js | 11 ++++++----- packages/svelte/src/internal/client/runtime.js | 15 +++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/svelte/src/internal/client/reactivity/deriveds.js b/packages/svelte/src/internal/client/reactivity/deriveds.js index 4cb02a7012..453f2b84d3 100644 --- a/packages/svelte/src/internal/client/reactivity/deriveds.js +++ b/packages/svelte/src/internal/client/reactivity/deriveds.js @@ -63,15 +63,16 @@ export function derived_safe_equal(fn) { } /** - * @param {import('#client').Derived} signal + * @param {import('#client').Derived} derived * @returns {void} */ -function destroy_derived_children(signal) { - destroy_effect_children(signal); - var deriveds = signal.deriveds; +function destroy_derived_children(derived) { + destroy_effect_children(derived); + var deriveds = derived.deriveds; if (deriveds !== null) { - signal.deriveds = null; + derived.deriveds = null; + for (var i = 0; i < deriveds.length; i += 1) { destroy_derived(deriveds[i]); } diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index 1296d6763e..1e9dfc5cd5 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -438,18 +438,17 @@ export function remove_reactions(signal, start_index) { /** * @param {import('#client').Reaction} signal - * @param {boolean} [remove_dom] + * @param {boolean} remove_dom * @returns {void} */ -export function destroy_effect_children(signal, remove_dom = true) { - let effect = signal.first; - signal.first = null; - signal.last = null; - var sibling; +export function destroy_effect_children(signal, remove_dom = false) { + var effect = signal.first; + signal.first = signal.last = null; + while (effect !== null) { - sibling = effect.next; + var next = effect.next; destroy_effect(effect, remove_dom); - effect = sibling; + effect = next; } }