-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Reinitialize non-registered values with keepDirtyOnReinitialize #311
Conversation
Codecov Report
@@ Coverage Diff @@
## master #311 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 560 560
Branches 116 116
=====================================
Hits 560 560
Continue to review full report at Codecov.
|
0a15337
to
c5cfb22
Compare
…eepDirtyOnReinitialize is not set, all non-registered values go to `form.values`, which is useful for computed values depending on such non-registered values. Replicate the same behavior when keepDirtyOnReinitialize is set as well.
c5cfb22
to
217dccb
Compare
Can you explain this a little better, and maybe provide an example? I'm not following 100%. |
Hi @erikras, of course. When updating
but when PS: I am short on time right now, so if you still need an example, I may provide one later this evening. Thanks! |
src/FinalForm.js
Outdated
if (pristine) { | ||
// only update pristine values | ||
formState.values = setIn(formState.values, key, getIn(values, key)) | ||
Object.keys(values).forEach(key => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only going to work with shallow/flat values
objects. FF supports deep values like shipping.address.street
, the metadata for which would be in safeFields['shipping.address.street']
.
Let me think about it some more...
I think I fixed it. |
Thanks a lot! There is simple companion PR against |
Published 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. |
When keepDirtyOnReinitialize is not set, all non-registered values go to
form.values
, which is useful for computed values depending on such non-registered values. Replicate the same behavior when keepDirtyOnReinitialize is set as well.