From ac757e398900f2e1db62085ae6dbe4a1b30dee7e Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 26 Jul 2023 15:40:01 -0700 Subject: [PATCH 1/2] Clear wizard interceptor on wizard start and close Without doing this, an interceptor from a different wizard can run when a new wizard is opened causing incorrect validation. --- src/lib/stores/wizard.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/stores/wizard.ts b/src/lib/stores/wizard.ts index 355eb7afce..3e0ed9ecc8 100644 --- a/src/lib/stores/wizard.ts +++ b/src/lib/stores/wizard.ts @@ -24,6 +24,7 @@ function createWizardStore() { update((n) => { n.show = true; n.component = component; + n.interceptor = null; n.media = media; trackEvent('wizard_start'); return n; @@ -39,6 +40,7 @@ function createWizardStore() { update((n) => { n.show = false; n.component = null; + n.interceptor = null; n.media = null; return n; From 7d1c041c973ed935870e18f9ed57dd5956f80a2d Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 26 Jul 2023 16:17:46 -0700 Subject: [PATCH 2/2] Fix wizard component type Before this, we kept getting warnings like: Type 'typeof Wizard__SvelteComponent_' is missing the following properties from type 'SvelteComponentDev' --- src/lib/stores/wizard.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/stores/wizard.ts b/src/lib/stores/wizard.ts index 3e0ed9ecc8..0eccf0be08 100644 --- a/src/lib/stores/wizard.ts +++ b/src/lib/stores/wizard.ts @@ -1,11 +1,11 @@ import { trackEvent } from '$lib/actions/analytics'; -import type { SvelteComponent } from 'svelte'; +import type { ComponentType } from 'svelte'; import { writable } from 'svelte/store'; export type WizardStore = { show: boolean; media?: string; - component?: typeof SvelteComponent; + component?: ComponentType; interceptor?: () => Promise; }; @@ -20,7 +20,7 @@ function createWizardStore() { return { subscribe, set, - start: (component: typeof SvelteComponent, media: string = null) => + start: (component: ComponentType, media: string = null) => update((n) => { n.show = true; n.component = component;