From bac8b044eb784ff636f2dea0f5b8f983bba3695e Mon Sep 17 00:00:00 2001 From: tanhauhau Date: Thu, 6 Oct 2022 01:59:10 +0800 Subject: [PATCH] feat: review changes --- src/runtime/internal/Component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index bbd10785cb..5aec24c651 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -22,7 +22,7 @@ export function claim_component(block, parent_nodes) { } export function mount_component(component, target, anchor, customElement) { - const { fragment, on_mount, on_destroy, after_update } = component.$$; + const { fragment, after_update } = component.$$; fragment && fragment.m(target, anchor); @@ -30,12 +30,12 @@ export function mount_component(component, target, anchor, customElement) { // onMount happens before the initial afterUpdate add_render_callback(() => { - const new_on_destroy = on_mount.map(run).filter(is_function); + const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); // if the component was destroyed immediately // it will update the `$$.on_destroy` reference to `null`. // the destructured on_destroy may still reference to the old array if (component.$$.on_destroy) { - on_destroy.push(...new_on_destroy); + component.$$.on_destroy.push(...new_on_destroy); } else { // Edge case - component was destroyed immediately, // most likely as a result of a binding initialising