Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue: Keep Dirty on reset does not work #11922

Closed
1 task done
islami00 opened this issue May 21, 2024 · 3 comments
Closed
1 task done

issue: Keep Dirty on reset does not work #11922

islami00 opened this issue May 21, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@islami00
Copy link

islami00 commented May 21, 2024

Version Number

7.48.2

Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/boring-wood-q9kyqz?file=%2Fsrc%2FApp.tsx

Steps to reproduce

  1. Go to Name Input
  2. Change the name
  3. Click on reset
  4. Open the devtools
  5. See that dirtyFields is not retained

Expected behaviour

DirtyFields should be retained when keepDirty is true on reset based on the docs:

DirtyFields form state will remain, and isDirty will temporarily remain as the current state until further user's action.Important: this keep option doesn't reflect form input values but only dirty fields form state.

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tomas1646
Copy link

The Codesandbox link isn't working: "Sandbox not found".

@islami00
Copy link
Author

Should be visible now @tomas1646

@mrKorg
Copy link

mrKorg commented May 25, 2024

@islami00 Thanks, you saved my time.
I found the same problem while updating the package.
isDirty started behaving differently after update when I use

useEffect(() => {
  if (isSubmitSuccessful) {
    reset({}, { keepValues: true });
  }
}, [isSubmitSuccessful, reset]);

@bluebill1049 bluebill1049 added the bug Something isn't working label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants