From 4a238ac041188fc819a34d77107a66e7b32d2677 Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 17 Nov 2021 13:15:30 -0800 Subject: [PATCH] refactor(switch): replace onDestroy with onMount return function --- src/ContentSwitcher/Switch.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ContentSwitcher/Switch.svelte b/src/ContentSwitcher/Switch.svelte index 092d9eca..68a76066 100644 --- a/src/ContentSwitcher/Switch.svelte +++ b/src/ContentSwitcher/Switch.svelte @@ -17,7 +17,7 @@ /** Obtain a reference to the button HTML element */ export let ref = null; - import { afterUpdate, getContext, onDestroy } from "svelte"; + import { afterUpdate, getContext, onMount } from "svelte"; const ctx = getContext("ContentSwitcher"); @@ -33,8 +33,8 @@ } }); - onDestroy(() => { - unsubscribe(); + onMount(() => { + return () => unsubscribe(); });