From b130de71dcc04764653465818b6492000d2884ea Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 23 Jun 2023 16:45:22 +0100 Subject: [PATCH] Persist the current step when remounting a form --- packages/client/src/components/app/forms/Form.svelte | 3 +++ packages/client/src/components/app/forms/InnerForm.svelte | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/app/forms/Form.svelte b/packages/client/src/components/app/forms/Form.svelte index b15ab55c5b..39c9bf4b59 100644 --- a/packages/client/src/components/app/forms/Form.svelte +++ b/packages/client/src/components/app/forms/Form.svelte @@ -2,6 +2,7 @@ import { getContext } from "svelte" import InnerForm from "./InnerForm.svelte" import { Helpers } from "@budibase/bbui" + import { writable } from "svelte/store" export let dataSource export let theme @@ -23,6 +24,7 @@ let loaded = false let schema let table + let currentStep = writable(1) $: fetchSchema(dataSource) $: schemaKey = generateSchemaKey(schema) @@ -92,6 +94,7 @@ {initialValues} {disableValidation} {editAutoColumns} + {currentStep} > diff --git a/packages/client/src/components/app/forms/InnerForm.svelte b/packages/client/src/components/app/forms/InnerForm.svelte index 9eb21b0bae..51f25c4971 100644 --- a/packages/client/src/components/app/forms/InnerForm.svelte +++ b/packages/client/src/components/app/forms/InnerForm.svelte @@ -13,11 +13,14 @@ export let disableValidation = false export let editAutoColumns = false + // We export this store so that when we remount the inner form we can still + // persist what step we're on + export let currentStep + const component = getContext("component") const { styleable, Provider, ActionTypes } = getContext("sdk") let fields = [] - const currentStep = writable(1) const formState = writable({ values: {}, errors: {},