-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Insert does not cause array children to refresh correctly. #138
Comments
Not only "insert" does not work, but "unshift" too. Sandbox Linkhttps://codesandbox.io/s/react-final-form-field-arrays-l15yi?file=/index.js |
I ended up writing my own mutator for insert: insertAt: (args, state, tools) => {
const [index, newStation] = args;
const roadmap: Roadmap =
tools.getIn(state, 'formState.values.roadmap') || [];
const newState = tools.setIn(state, 'formState.values.roadmap', [
...roadmap.slice(0, index),
newStation,
...roadmap.slice(index),
]);
Object.assign(state, newState);
}, |
Hi @trumbitta , I added this to the |
I ended up replacing the mutator with the following:
But I really don't know if this breaks something somewhere else. I looked into the code and there was no chance for me to wrap my head around the state management in these mutators. |
any progress? how is that insert is still not working? =( |
i have the same problem with |
Insert still not working. Versions of things i'm on: I'm wondering if upgrading to a newer version of React will help resolve? Would it be possible to update the documentation to state that this is broken on x version? |
same issue for me |
I have an update about this issue and submitted the PR |
Are you submitting a bug report or a feature request?
Bug
What is the current behavior?
https://codesandbox.io/s/ypj0p?file=/src/App.js
Insert does not cause the full array to refresh causing children to display out of date data.
What is the expected behavior?
When an insert occurs, all children components of the array re-render appropriately
Sandbox Link
https://codesandbox.io/s/ypj0p?file=/src/App.js
What's your environment?
(See sandbox link)
Other information
The text was updated successfully, but these errors were encountered: