devtool prevent field in values prop from registering

Open
#197 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
devtools, frontend

Research direction

Start with the reproduction in /src/App.tsx and compare useForm({ defaultValues: { str } }) with the useForm({ values: { str } }) update while DevTools is enabled. Verify the reported behavior in the CodeSandbox; done means the field registers and its displayed value updates in the values case as it does with defaultValues.

Written by the indexing model from the issue text.

Description

Version Number

react-hook-form: 7.43.9
react: 18.2.0

Codesandbox/Expo snack

https://codesandbox.io/s/hookform-devtools-bug-devtool-prevent-field-in-values-prop-from-registering-minvzb?file=/src/App.tsx

Steps to reproduce

I have two video clip to demonstrate. Both two demo had devtool on.

By useForm({ defaultValues: { str } }). It works as expect.

https://user-images.githubusercontent.com/38932402/229013340-0d389873-ae62-4922-91fd-e97e5d417d12.mp4

By useForm({ values: { str } }). I use a useEffect to trigger the update behavior of values. The field seems not to be registered as the "value" show above the input is never updated.

https://user-images.githubusercontent.com/38932402/229014523-8c7695e4-65b5-4b66-8774-c5dbb812f1ef.mp4

Dominant language
TypeScript
Stars
670
Forks
55
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-hook-form/devtools

All issues in react-hook-form/devtools

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.