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

Abierto
#200 1 comentario 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
react, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
TypeScript
Estrellas
670
Forks
55
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de react-hook-form/devtools

Todos los issues de react-hook-form/devtools

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.