question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

omitResetState not working

See original GitHub issue

Describe the bug

Setting dirtyFields on omitResetState argument when using reset does not seem to prevent dirty fields being reset. Am I missing something? My goal is to reset values when I receive a refresh from API, but I don’t want dirty fields to be reset.

To Reproduce Steps to reproduce the behavior:

  1. Open this codesandbox
  2. Edit “Note” or “Email”
  3. Click on ''Reset data"
  4. Even if note and/or email are dirty due to step 2, they are being reset

Codesandbox link

https://codesandbox.io/s/clever-hooks-01dt2?file=/App.js

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bluebill1049commented, Sep 2, 2020

That’s all good 👍 @dhmacs thanks for giving a test.

1reaction
dhmacscommented, Aug 31, 2020

I’ll try to implement this so I can formulate a better feature request

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to reset setValues in react-hook-form version 7?
I have form some prefilled values from api and i set them with setValues('input-field-name','value-got-from-api') and when a i use reset method ...
Read more >
Migrate From V6 to V7 - Simple React forms validation
Performant, flexible and extensible forms with easy-to-use validation.
Read more >
Learn the most of react-hook-form in less than 5 minutes
React Hook Form is a tiny library without any dependencies. ... By supplying omitResetState , you have the freedom to only reset specific ......
Read more >
react-hook-form: Versions - Openbase
running reset() error when not found will be silenced and throw a console warning. 3.8.4. 4 years ago.
Read more >
[React] React Hook Form (v7)알아보기 - WONILLISM's Blog
not working, because ref is not assigned <TextInput {...register('test')} /> const firstName ... Record<string, any>, omitResetState?:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found