From b210fe3c9d7b69eb0e7f6bcf17034ef5150ad64e Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Tue, 2 Apr 2024 22:49:29 +0100 Subject: [PATCH] chore: remove parent DOM before children DOM (#11038) --- .../svelte/src/internal/client/reactivity/effects.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/svelte/src/internal/client/reactivity/effects.js b/packages/svelte/src/internal/client/reactivity/effects.js index 5506737e31..4d54e4e887 100644 --- a/packages/svelte/src/internal/client/reactivity/effects.js +++ b/packages/svelte/src/internal/client/reactivity/effects.js @@ -234,6 +234,12 @@ export function branch(fn) { * @returns {void} */ export function destroy_effect(effect) { + var dom = effect.dom; + + if (dom !== null) { + remove(dom); + } + destroy_effect_children(effect); remove_reactions(effect, 0); set_signal_status(effect, DESTROYED); @@ -246,10 +252,6 @@ export function destroy_effect(effect) { effect.teardown?.call(null); - if (effect.dom !== null) { - remove(effect.dom); - } - var parent = effect.parent; // If the parent doesn't have any children, then skip this work altogether