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,7 +1,7 @@
|
|||
<script>
|
||||
import Placeholder from "../Placeholder.svelte"
|
||||
import FieldGroupFallback from "./FieldGroupFallback.svelte"
|
||||
import { getContext } from "svelte"
|
||||
import { getContext, onDestroy } from "svelte"
|
||||
|
||||
export let label
|
||||
export let field
|
||||
|
@ -31,10 +31,13 @@
|
|||
formStepContext || 1
|
||||
)
|
||||
|
||||
// Expose field properties to parent component
|
||||
$: fieldState = $formField?.fieldState
|
||||
$: fieldApi = $formField?.fieldApi
|
||||
$: fieldSchema = $formField?.fieldSchema
|
||||
// Update form properties in parent component on every store change
|
||||
const unsubscribe = formField.subscribe(value => {
|
||||
fieldState = value?.fieldState
|
||||
fieldApi = value?.fieldApi
|
||||
fieldSchema = value?.fieldSchema
|
||||
})
|
||||
onDestroy(unsubscribe)
|
||||
|
||||
// Keep validation rules up to date
|
||||
$: updateValidation(validation)
|
||||
|
|
Loading…
Reference in New Issue