diff --git a/packages/builder/src/pages/builder/portal/apps/onboarding/index.svelte b/packages/builder/src/pages/builder/portal/apps/onboarding/index.svelte index 8e018ae907..546f5f57ba 100644 --- a/packages/builder/src/pages/builder/portal/apps/onboarding/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/onboarding/index.svelte @@ -107,8 +107,9 @@ useSampleData, isGoogle, }) => { + let app try { - const app = await createApp(useSampleData) + app = await createApp(useSampleData) let datasource if (datasourceConfig) { @@ -134,6 +135,17 @@ console.log(e) creationLoading = false notifications.error("There was a problem creating your app") + + // Reset the store so that we don't send up stale headers + store.actions.reset() + + // If we successfully created an app, delete it again so that we + // can try again once the error has been corrected. + // This also ensures onboarding can't be skipped by entering invalid + // data credentials. + if (app?.appId) { + await API.deleteApp(app.appId) + } } } @@ -146,80 +158,87 @@ /> - - {#if stage === "name"} - (stage = "data")} /> - {:else if googleComplete} -
- Please login to your Google account in the new tab which as opened to - continue. -
- {:else if integrationsLoading || creationLoading} -
- -
- {:else if stage === "data"} - (stage = "name")}> -
- handleCreateApp({ useSampleData: true })}> -
-
- -
- Budibase Sample data -
-
+
+ + {#if stage === "name"} + (stage = "data")} /> + {:else if googleComplete} +
+ Please login to your Google account in the new tab which as opened to + continue.
-
- -
-
- -
- Upload data (CSV or JSON) -
-
+ {:else if integrationsLoading || creationLoading} +
+
- {#each Object.entries(plusIntegrations) as [integrationType, schema]} + {:else if stage === "data"} + (stage = "name")}>
- (stage = integrationType)}> + handleCreateApp({ useSampleData: true })} + >
- +
- {schema.friendlyName} + Budibase Sample data
- {/each} -
- {:else if stage in plusIntegrations} - (stage = "data")} - onNext={data => { - const isGoogle = data.isGoogle - delete data.isGoogle - return handleCreateApp({ datasourceConfig: data, isGoogle }) - }} - /> - {:else} -

There was an problem. Please refresh the page and try again.

- {/if} -
- -
- +
+ +
+
+ +
+ Upload data (CSV or JSON) +
+
+
+ {#each Object.entries(plusIntegrations) as [integrationType, schema]} +
+ (stage = integrationType)}> +
+
+ +
+ {schema.friendlyName} +
+
+
+ {/each} + + {:else if stage in plusIntegrations} + (stage = "data")} + onNext={data => { + const isGoogle = data.isGoogle + delete data.isGoogle + return handleCreateApp({ datasourceConfig: data, isGoogle }) + }} + /> + {:else} +

There was an problem. Please refresh the page and try again.

+ {/if} +
+ +
+ +