From 4c5748903c36b356093bef74db3eb5c232e7ffc3 Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 17 Apr 2024 11:59:28 +0200 Subject: [PATCH 1/2] fix: add option to pass final action directly to the wizard so it can be awaited --- src/lib/layout/wizard.svelte | 15 +++++++++++---- .../createProjectCloud.svelte | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lib/layout/wizard.svelte b/src/lib/layout/wizard.svelte index b55c4ff3c..e8e525572 100644 --- a/src/lib/layout/wizard.svelte +++ b/src/lib/layout/wizard.svelte @@ -24,6 +24,7 @@ export let steps: WizardStepsType; export let confirmExit = false; export let finalAction = 'Create'; + export let finalMethod: () => Promise = null; const dispatch = createEventDispatcher(); @@ -94,11 +95,17 @@ } } else { $wizard.nextDisabled = true; - trackEvent('wizard_finish'); - dispatch('finish'); - setTimeout(() => { + if (finalMethod) { + await finalMethod(); $wizard.nextDisabled = false; - }, 2000); + } else { + trackEvent('wizard_finish'); + dispatch('finish'); + + setTimeout(() => { + $wizard.nextDisabled = false; + }, 2000); + } } } else { if (steps.get($wizard.step + 1)?.disabled) { diff --git a/src/routes/console/organization-[organization]/createProjectCloud.svelte b/src/routes/console/organization-[organization]/createProjectCloud.svelte index 4c228c28e..953c70023 100644 --- a/src/routes/console/organization-[organization]/createProjectCloud.svelte +++ b/src/routes/console/organization-[organization]/createProjectCloud.svelte @@ -67,4 +67,4 @@ }); - + From becf053f33ccd6d864265bd02af944538d49fb83 Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 17 Apr 2024 12:04:55 +0200 Subject: [PATCH 2/2] chore: add tracking --- src/lib/layout/wizard.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/layout/wizard.svelte b/src/lib/layout/wizard.svelte index e8e525572..145926af6 100644 --- a/src/lib/layout/wizard.svelte +++ b/src/lib/layout/wizard.svelte @@ -97,6 +97,7 @@ $wizard.nextDisabled = true; if (finalMethod) { await finalMethod(); + trackEvent('wizard_finish'); $wizard.nextDisabled = false; } else { trackEvent('wizard_finish');