Skip to content

Commit c77b39c

Browse files
fix(ui): hidden input should wait for form initialization (#13114)
1 parent 5e82f9f commit c77b39c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/ui/src/fields/Hidden/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import { withCondition } from '../../forms/withCondition/index.js'
1515
const HiddenFieldComponent: React.FC<HiddenFieldProps> = (props) => {
1616
const { disableModifyingForm = true, path: pathFromProps, value: valueFromProps } = props
1717

18-
const { path, setValue, value } = useField({
18+
const { formInitializing, path, setValue, value } = useField({
1919
potentiallyStalePath: pathFromProps,
2020
})
2121

2222
useEffect(() => {
23-
if (valueFromProps !== undefined) {
23+
if (valueFromProps !== undefined && !formInitializing) {
2424
setValue(valueFromProps, disableModifyingForm)
2525
}
26-
}, [valueFromProps, setValue, disableModifyingForm])
26+
}, [valueFromProps, setValue, disableModifyingForm, formInitializing])
2727

2828
return (
2929
<input

0 commit comments

Comments
 (0)