1
0
Fork 0
mirror of synced 2024-07-03 05:20:32 +12:00

Only show the selected step if not already selected

This commit is contained in:
Andrew Kingston 2021-08-19 14:56:56 +01:00
parent 7605999a59
commit 11c7f15089

View file

@ -2,7 +2,7 @@
import { getContext, setContext } from "svelte"
import Placeholder from "../Placeholder.svelte"
export let step
export let step = 1
const { styleable, builderStore } = getContext("sdk")
const component = getContext("component")
@ -14,16 +14,15 @@
$: formState = formContext?.formState
$: currentStep = $formState?.currentStep
// If in the builder preview, show this step if it is selected
// If in the builder preview, show this step if a child is selected
$: {
if (step && formContext && $builderStore.inBuilder) {
console.log($builderStore.selectedPath)
console.log($component.id)
if ($builderStore.selectedComponentPath?.includes($component.id)) {
console.log("selecting " + step)
formContext.formApi.setStep(step)
}
if (
formContext &&
$builderStore.inBuilder &&
$builderStore.selectedComponentPath?.includes($component.id) &&
$formState?.currentStep !== step
) {
formContext.formApi.setStep(step)
}
}
</script>