When DevTools are enabled, resetting form works only on the second time

Aperta
#200 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react, typescript
Ambito
devtools, frontend

Direzione di ricerca

Start with the linked CodeSandbox reproduction and compare the reset and watch behavior with and without React Hook Form DevTools enabled. Trace the reset button, the watched field, and the DevTools integration; done means the field and console log update on the first reset click in both configurations.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When DevTools are enabled, re-initializing fields by resetting them only work the second time.
I created a Code sandbox to reproduce the issue

Steps to reproduce
  1. Create a form with a field
  2. Add a console log with a watch for that field
  3. Add a reset button that calls React Hook Form's reset method
  4. Test your page by filling in data for the field, and click on the reset button : you should see the console log with the reinitialized data for the field, and the field should be reinitialized
  5. Add DevTools to the page and click the reset button
Result
  • The console log is shown only the second time the reset button is clicked
  • The field is reset only the second second time the reset button is clicked
  • Everything works fine if DevTools are not enabled
Expected result
  • The console log should be shown with the reinitialized data
  • The field should be reinitialized
Lingua principale
TypeScript
Stelle
670
Fork
55
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di react-hook-form/devtools

Tutte le issue di react-hook-form/devtools

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.