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 broken in v 8.2 #4439
Comments
This is a major issue and I can confirm that it's not working 8.0.0 onwards. Must be something more fundamental due to v8 change. |
@nikhilag I have a simple codesandbox working on 8.1 https://codesandbox.io/s/30xx4588lm Fairly certain was something with the commit I referenced above |
Experiencing the same error on |
Anyone have a workaround for now? |
+1 |
same issue here :( |
Today I have to validate if one FieldArray has elements, using this (as the documentation says): With that on the validator, I receive this error: |
+1 Tried downgrading to 8.1 but still had problems. |
I assumed it was related to #4138 which was released in I have managed to get this working with Also, the example for 8.1.0 docs also errors when you click 'Add member': |
After some Investigation it definitely seems to be related to #4313/#4337 from @esetnik - I am going to fork and revert that change as a temporary solution. I would recommend starting the conversion to |
Hi all! Made the revert of the PR that caused this problem. Will release a new version in the next few hours. :) |
@renatoagds Great news thanks! I hadn't forked it quite yet. I would recommend that the new version includes a release for the docs so that the Field Array example works again! |
Published fix in |
The issue is that if you revert the PR then it will break redux-form ImmutableJS compatibility. I'm sorry for the trouble my PR #4337 caused everyone! It seems that some lower level functionality needs to be rewritten in the library to support both Immutable and non-Immutable usage. The issue with enabling loose mode is that now the immutable lists will be assumed to be arrays. This will break a number of functions when used with Immutable. There should be a warning for users of redux-form and ImmutableJS not to update to v8.2.1 or it will break their project. Also I suggest that v8.2.1 tag should be removed and the next release version should be v9.0.0 since this is a breaking change for ImmutableJS users. If ImmutableJS support is officially being dropped then that should be noted that v8.2.0 is the last version with support. |
The real fix here is that we shouldn't be using rest parameters on functions that can receive Immutable data structures |
From what you're saying, @esetnik, it sounds like the best possible contribution you could make, would be a failing test with expected immutable data, and a passing test with expected non-immutable data, such that the maintainers (or anyone with some time and motivation) can provably make a general case. Not only would this allow for fixing the re-broken immutable functionality, it would have prevented the immutable functionality initially breaking everyone else's toys. |
@esetnik Agreed with you that we should warn about Immutable problem, I changed the release description to include that. Btw, I would ask your help to list the current bugs that we have in Immutable part of ReduxForm. Do you think that we have more problems in Immutable parts? If yes, could you please open a issue to list them? So I could help to get them fixed. |
To my knowledge there are no other issues with ImmutableJS in the project. I don't have too much time at the moment, but we should do an investigation of everywhere the spread operator is used on "Array" values which may not actually be arrays (they might be ImmutableJS List type). The specific issue I fixed is related to how https://github.com/erikras/redux-form/blob/f20e4bed7e4185d7d18593732a4b5d75529f3452/src/structure/immutable/index.js#L31 Which is used to wrap the return value of This means that when using #4471 fixes this particular issue by detecting if Technically any |
`src/createReduxForm.js` -> `Form.getFieldList` should return a plain js array, but it returned in some cases an immutable `Seq`, that couldn't be spread in `handleSubmit` Moved `immutable` to peer dependencies, because optional dependencies will install it always. Related #4313 Related #4439 Related #4476 Related #4471 Related #4473 Related #4474 Closes #4519
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. |
1 similar comment
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?
Pushing a new field into a field array is broken
TypeError: Invalid attempt to spread non-iterable instance
in consoleWhat is the expected behavior?
A new member field should be pushed into the field array
Sandbox Link
https://codesandbox.io/s/nrzq9mzp34
https://nrzq9mzp34.codesandbox.io/
What's your environment?
Redux-form v8.2 (not 8.1)
At least Chrome 73, Safari 12.1, Firefox 65
Other information
Recent potentially related commit fc3b48d I say potentially as I see it was added in 8.2 and has the word FieldArray in it. Haven't wrapped my head around it all
The text was updated successfully, but these errors were encountered: