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

Field > change key with resetCount #615

Open
testplop opened this issue Aug 25, 2023 · 1 comment
Open

Field > change key with resetCount #615

testplop opened this issue Aug 25, 2023 · 1 comment

Comments

@testplop
Copy link

testplop commented Aug 25, 2023

Hi,

Why are you changing the Fragment key each time there is a reset?

In render of Field we have this:

return <React.Fragment key={resetCount}>{returnChildNode}</React.Fragment>;

This is causing unwanted unmount/remount of the Field each time we reset the form.

I don't see the point of doing that, but maybe I'm missing something. Can you help me understand?

@astakhovaskold
Copy link

Hi,

Why are you changing the Fragment key each time there is a reset?

In render of Field we have this:

return <React.Fragment key={resetCount}>{returnChildNode}</React.Fragment>;

This is causing unwanted unmount/remount of the Field each time we reset the form.

I don't see the point of doing that, but maybe I'm missing something. Can you help me understand?

Hello,
the reason for this forced update is the current node being cleared

This action is necessary to ensure that the field will be updated even if it has been memoized or cached.

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

2 participants