🌏 feature: support global error type #9746
const onSubmit = () => {
const response = await fetch(...)
if (response.statusCode > 200) {
setError('root.serverError', {
type: response.statusCode,
})
}
}
const onClick = () => {
setError('root.random', {
type: 'random',
})
}
return (
<>
{errors.root.serverError.type === 400 && <p>server response message</p>}
<p>{errors.root?.serverError?.message}</p>
<p>{errors.root?.random?.message}</p>
</>
)
🪜 fix set values
for controlled components (#9780)
const { control } = useForm({ values: { test: '' } })
<Controller name="test" /> // no longer throw react warning for uncontrolled become controlled.
🚓 stronger typing to document non-spec attribute uses (#9809)
register('number', {
valueAsNumber: true,
pattern: /[1-4]/g // ❌ type error
})
🏋🏻♀️ reduce package size (#9778)
🧧 reduce unknown and any (#9816)