Skip to content
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

Bug - deleting row #145

Open
omerman opened this issue Aug 7, 2020 · 4 comments
Open

Bug - deleting row #145

omerman opened this issue Aug 7, 2020 · 4 comments

Comments

@omerman
Copy link

omerman commented Aug 7, 2020

Assuming we render the array with editable items,
like so, {fields.map((arrPrefix) => <Field name={${arrPrefix}.val1} />}

When deleting a row of a field array
all of the indexes following the row becomes dirty, in the form.dirtyFields.

I think it happens because the Field component of say item[1].val1 isEqual will return false once deleting say item[0].val1.
I think the isEqual should be different when the Field is looking at a nested array field, surely a change in Field would be wrong, but Im thinking there should at least be a FieldArrayCell that will render also accept id prop(along with Field props) and will use this to send the isEqual the correct values, and then, the isEqual will evaluate correctly, and form.dirtyFields will be correct.

@OnkelTem
Copy link

OnkelTem commented Aug 28, 2020

I stumbled upon the same problem. Have you found a solution @omerman ?

@omerman
Copy link
Author

omerman commented Aug 28, 2020

@OnkelTem Instead of relying on the dirty fields for arrays with delete option.. I checked versus the initial values instead..
In my specific use cases it was enough.. But its not ideal..

@ymoran00
Copy link

It's really irritating :(

@omerman
Copy link
Author

omerman commented Jun 28, 2021

It's really irritating :(

It is, but to fix it you'd have to have some breaking changes.. like enforce a unique Id for each row. It is possible.. but seems like a lot of work..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants