Additional changes to review1 matched termMatched wording:deprecatedThese matches may be harmless in context. Expand to see the excerpts.
- The changelog mentions deprecation; it may still be compatible.
⏳ close #9525 add isLoading state for async defaultValues (#9526) 🐞 fix #9581 incorrect type for array of string for message (#9584) 🐞 fix validation issue with unregister input with valueAsNumber () 🐞 fix(useWatch): default value for array of inputs () 📔 fix Controller example using deprecated as prop () 🐞 fix isValidting property stuck () 🔨 feat: Migrate to pnpm () 🎹 fix incorrect type for WatchObserver () 🌳 include flush root render method to createFormControl ()
👉 NEW values props
The following syntax will react to values prop update/changes.
- values will be reactive to update/change and reset accordingly
- provide a reset option to keep dirty/touched values potentially
const values = await fetch('API')
useForm({
values, // will reset the form when values updates
// resetOptions: {
// keepDirtyValues: true
// }
})
👉 NEW async defaultValues props
The following syntax will support async defaultValues, so we will manage the reset form internally and update formState accordingly.
- promise will only be resolved once during
useForm()call - It's possible to supply
resetOptionsas well
const { formState: { isLoading } } = useForm({
defaultValues: fetch('API')
// resetOptions: {
// keepDirtyValues: true
// }
})
React use API
useForm({
defaultValues: use(fetch('API'))
// resetOptions: {
// keepDirtyValues: true
// }
})