๐ New Feature: Built-in DevTools
Introducing a new lightweight, built-in DevTool for inspecting and debugging your forms, without installing an additional package. (#13909)
DevTools are available through a separate entry point, keeping them out of your core bundle when unused.
import { useForm } from 'react-hook-form';
import { DevTool } from 'react-hook-form/devtools';
function App() {
const { register, control } = useForm();
return (
<>
<input {...register('firstName')} />
<DevTool control={control} />
</>
);
}๐ Fixes
- Fix
registernot recording disabled state on first registration (#14029) - Fix
handleSubmitnot stopping at the first invalid nested field with native validation (#14026) - Fix native validation reporting on disabled group inputs (#14031)
- Fix
useFormnot preserving options from an existingformControl(#14046) - Fix
useWatchunnecessarily recomputing values during cleanup (#14045) - Fix
isValidnot stopping at the first invalid nested field (#14043) - Fix pending asynchronous validation overwriting reset state (#14042)
- Fix
resetfailing when a form control is namedreset(#14037) - Fix stale validation results after nested value changes (#14053)
- Fix
useFieldArraydisplaying resolver errors for untouched rows inonTouchedmode (#14054) - Fix
triggernot awaiting form-level validation before validating named fields (#14055) - Fix
Controllerrequired validation passing for empty file inputs (#14061) - Fix
registerretaining removed validation dependencies (#14062) - Fix resolver-based
isValidchecks triggering native validation messages (#14064) - Fix
useFieldArraylosing per-row dirty state when validation rules are provided (#14065) - Fix
resetandresetFieldretaining native validation messages (#14067) - Fix
setValuenot preserving registered object fields when setting parent values (#14068) - Fix
clearErrorsretaining native validation messages (#14071) - Fix
getValuesfiltering values whendirtyFieldsortouchedFieldsis false (#14083) - Fix object-valued registered fields not being tracked as a single dirty field (#14074)
- Fix
setValuenot clearing multiple select options for nullish values (#14075) - Fix
resetnot preserving mounted form state withkeepValues(#14087) - Fix
resetnot applying values withkeepDefaultValuesandshouldUnregister(#14086) - Fix
useControllerdirty state becoming inconsistent when ashouldUnregisterfield remounts (#14081) - Fix
resetFieldnot discarding pending asynchronous validation results (#14091) - Fix
useFieldArraylosing remaining row registrations after removal when validation rules are provided (#14094) - Fix field array dirty state when updating values from a parent field (#14095)
โก Performance Improvements
- Optimize
cloneObjectby iterating over own object keys (#14051)
๐งน Refactors
- Remove redundant promise validation guard (#14057)
- Consolidate
FileListchecks across internal utilities (#14063)
๐งช Tests
- Expand regression coverage for asynchronous validation, native validation, field arrays, dirty state, and reset behaviour
- Add unit and end-to-end tests for the new DevTools
- Fix Jest coverage configuration (#14058)
๐ฆ Dependencies
โค๏ธ Thank You
Thanks to @Sophran-fbj, @dfedoryshchev, @yuxino, @ninglinLiu, @h00ns, @itisrmk, @charan-rathore, @CharoenwitKunna, @wozhenbang2004, @g4lb, @candymask0712, @oyobbeb, @sagarrsharmaa, @phatstraws, @Chen1098, @turalbabayev, @ErickGCA, @smcqueen-sudo and @bluebill1049 for their contributions! ๐
Special thanks to the Acquisity and Limetec Biotechnologies teams for their incredible support! โค๏ธ