Fix issue with svelte reactive statements not being sufficiently 'reactive' in core form field in client lib by replacing with manual store subscription
This commit is contained in:
parent
8c114fae34
commit
918f269e6e
1 changed files with 8 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import Placeholder from "../Placeholder.svelte"
|
import Placeholder from "../Placeholder.svelte"
|
||||||
import FieldGroupFallback from "./FieldGroupFallback.svelte"
|
import FieldGroupFallback from "./FieldGroupFallback.svelte"
|
||||||
import { getContext } from "svelte"
|
import { getContext, onDestroy } from "svelte"
|
||||||
|
|
||||||
export let label
|
export let label
|
||||||
export let field
|
export let field
|
||||||
|
@ -31,10 +31,13 @@
|
||||||
formStepContext || 1
|
formStepContext || 1
|
||||||
)
|
)
|
||||||
|
|
||||||
// Expose field properties to parent component
|
// Update form properties in parent component on every store change
|
||||||
$: fieldState = $formField?.fieldState
|
const unsubscribe = formField.subscribe(value => {
|
||||||
$: fieldApi = $formField?.fieldApi
|
fieldState = value?.fieldState
|
||||||
$: fieldSchema = $formField?.fieldSchema
|
fieldApi = value?.fieldApi
|
||||||
|
fieldSchema = value?.fieldSchema
|
||||||
|
})
|
||||||
|
onDestroy(unsubscribe)
|
||||||
|
|
||||||
// Keep validation rules up to date
|
// Keep validation rules up to date
|
||||||
$: updateValidation(validation)
|
$: updateValidation(validation)
|
||||||
|
|
Loading…
Reference in a new issue