Persist the current step when remounting a form

This commit is contained in:
Andrew Kingston 2023-06-23 16:45:22 +01:00
parent 4788972362
commit b130de71dc
2 changed files with 7 additions and 1 deletions

View File

@ -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}
>
<slot />
</InnerForm>

View File

@ -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: {},