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

fix: use right index for the transition in SimpleFormIterator #7404

Merged

Conversation

alanpoulain
Copy link
Contributor

@alanpoulain alanpoulain commented Mar 18, 2022

Before:
image
After:
image

It's probably because the id of the fields is changing (id is generated from useFieldArray), and the ref needs to be changed as well (see http://reactcommunity.org/react-transition-group/transition/#Transition-prop-nodeRef).

Using the previous code from master is needed to solve this issue.
I needed to revert #7123 as well, I don't understand how the change in this PR can work.

@WiXSL
Copy link
Contributor

WiXSL commented Mar 21, 2022

@alanpoulain, thanks for working on this.
It seems to work, although, I see some other problems like adding items after removing all items creates empty items.
But that is a different issue.

UPDATE:
If I remove the TransitionGroup/CSSTransition component completely, everything works.
So, the problem seems to be there, but I cannot find the issue.

@djhi djhi added this to the 4.0.0-beta.4 milestone Mar 23, 2022
@djhi
Copy link
Collaborator

djhi commented Mar 23, 2022

Thanks!

@djhi djhi merged commit ba6a5ae into marmelab:next Mar 23, 2022
@djhi
Copy link
Collaborator

djhi commented Mar 24, 2022

I should have remembered why I used react-hook-form id instead of our own. This introduces weird issues that you can see on the deployed simple example for the PR.

Open https://react-admin-az7z4sx9x-marmelab.vercel.app/#/posts/13

Add two backlink, remove one, add another:
array-input-issue

@alanpoulain
Copy link
Contributor Author

Maybe the alternative is to make sure the id from useFieldArray doesn't change then.

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

Successfully merging this pull request may close these issues.

3 participants