From 1309eaef2031209e8528df6930967de5253d6604 Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 17 Nov 2021 13:15:08 -0800 Subject: [PATCH] refactor(select-item): replace onDestroy with onMount return function --- src/Select/SelectItem.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Select/SelectItem.svelte b/src/Select/SelectItem.svelte index 48cf52ef..7edae98c 100644 --- a/src/Select/SelectItem.svelte +++ b/src/Select/SelectItem.svelte @@ -11,7 +11,7 @@ /** Set to `true` to disable the option */ export let disabled = false; - import { getContext, onDestroy } from "svelte"; + import { getContext, onMount } from "svelte"; const ctx = getContext("Select") || getContext("TimePickerSelect"); @@ -21,8 +21,8 @@ selected = currentValue === value; }); - onDestroy(() => { - unsubscribe(); + onMount(() => { + return () => unsubscribe(); });