-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
FieldArray removing property names if value is empty on blur (added after initialization) #3366
Comments
This issue affect the architecture of my app too. But it is not only related to So If I try to manually add To manually add a value we must use Finally I suppose the following things can fix the issue:
I'm pretty new to redux-form I don't know if it can bring side effects. Any idea contributors ? |
Having the same problem. Maybe the Edit: just realised that it tries to do this, but the the cleanUp also deletes the parent structure if empty. Will investigate a bit more and then create a PR... Edit 2: related issue: #2597 (comment) |
The equivalence of The "Never Filled Out" and "Left Empty" cases need to be equivalent when calculating pristine/dirty. Is there some reason that you absolutely need |
easier ? it depends on the feature/application architecture. (If I remember well, because I just disabled it) So yes, In my case, I can duplicate the state of the form but with two source of trust it becomes no more maintainable. @erikras thank you for making this great but complex library OSS. Keep the good work. I whish I can help more. |
@erikras Can you start thinking of a v8 with a definitive solution ? I would love
Values would be either null, non empty string or string[] (for select multiple). This would be a breaking change, but I can't state enough how huge this would be for the dirty tracking, the cleanliness of implementation and model. There are so many issues today with falsy values I just sometimes want to rage-quit. Plus the checkbox |
Yeah, I think its time for v8 ^^ We are also using this format function as default for our fields: |
@erikras - Any status update on this issue? |
same problem |
This is a problem for me as well, but I just resorted to managing the actual desired behavior through state rather than using the current values in the store. IMO, the only annoying part of the current implementation is that onBlur unexpectedly manipulates values, not necessarily that empty/blank values in the store are treated the same as unset ones. It's not ideal to have manage the state at the same time as the store, but I can live with it. |
@UlyssesInvictus Looks like my PR got merged, it should work with a version where this one is included: #3619 |
I just add to an input in the FieldArray: value={props.input.value || ' '} and after use trim(). |
Fix released in |
thanks))
2018-06-12 11:27 GMT+03:00 Erik Rasmussen <notifications@github.com>:
… Closed #3366 <#3366>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3366 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQ57rMSnoVVllj8Flrce_gLaAZseQfLwks5t73t8gaJpZM4PGZ9B>
.
|
I was seeing this issue as well, so I installed |
I upgraded to 7.4.0 but am still experiencing this exact behavior. Is there a flag that needs to be set somewhere or something? |
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?
Bug Report
What is the current behavior?
When an object is pushed to a field array, it can have properties with values defined in advance. (In the example below, note 'bob' as a pre-defined
firstName
when adding a member. However, when a property's value is an empty string blurring the corresponding input field causes the the form values to drop the property name in question.To reproduce:
This appears to happen in
@@redux-form/BLUR
.What is the expected behavior?
That the key/value persist in the object.
Sandbox Link
A reproduction of the issue.
What's your environment?
react v15.4.1
redux v3.6.0
redux-form v6.3.2
Other information
The text was updated successfully, but these errors were encountered: