Skip to content

Commit 29a65ed

Browse files
committed
fix(react-form): Make form.options reactive by adding getter
Fixes an issue where form.options.defaultValues was not reactive when initializing a form with async data. The options object was captured in the useMemo closure and never updated when formApi.options changed. Adding a getter for options (similar to the existing state getter) ensures that the latest options are always returned, fixing reactivity issues when comparing current values to defaultValues.
1 parent ba32b7f commit 29a65ed

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/react-form/src/useForm.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ export function useForm<
237237
get state() {
238238
return formApi.store.state
239239
},
240+
get options() {
241+
return formApi.options
242+
},
240243
} as never
241244

242245
extendedApi.Field = function APIField(props) {

0 commit comments

Comments
 (0)