-
-
Notifications
You must be signed in to change notification settings - Fork 491
Pristine with form array fields #151
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
Comments
I have the same issue. Is there a way to fix this? |
You have to pass initial state to reset. <ActionButton
type="button"
onClick={() => reset(INITIAL_VALUES)}
disabled={submitting || pristine}
> https://github.com/final-form/final-form#reset-initialvalues-object--void |
@snhasani the issue is not related to that. It's expected for a field to recover its You can read a better explanation here: final-form/final-form#55 (comment) I updated the dependencies for the original code that @Gi972 posted, and it's still happening: https://codesandbox.io/s/x99z5mzn6w |
Confirmed. This is a bug. |
I opened a ticket on @erikras - Let me know if I should close my ticket there as a duplicate (not sure if its an issue with rff or rffa). |
also having this issue |
this issue also happens when you have keepDirtyOnReinitialize on the form and there is a rerender |
I'm on it |
update: debugged. I'll describe it on the first @Gi972 example. It's because This is problematic, because later final-form iterate over all fields and compare their initial values to current values using triple equals. Since |
from what I understand, registering I see 3 possible solutions:
|
ok, I wrote tests and solved the issue in this PR ☝️ |
Published fix in |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Are you submitting a bug report or a feature request?
I report a bug
What is the current behavior?
I use the form array field with a initialized value, when I change the value (in the example, I put "toto", next "tot" and back with "toto") so I come back on the initial value of the select component but
the pristine doesn't come back at the initial value.
I Fork the field Array example here:
https://codesandbox.io/s/j7o525yn23
Thanks @erikras
The text was updated successfully, but these errors were encountered: