field-form icon indicating copy to clipboard operation
field-form copied to clipboard

Field > change key with resetCount

Open testplop opened this issue 2 years ago • 1 comments

Hi,

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

In render of Field we have this: https://github.com/react-component/field-form/blob/e9184848e73a5e39fd2976826a7020328dba01ed/src/Field.tsx#L644

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?

testplop avatar Aug 25 '23 17:08 testplop

Hi,

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

In render of Field we have this:

https://github.com/react-component/field-form/blob/e9184848e73a5e39fd2976826a7020328dba01ed/src/Field.tsx#L644

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.

astakhovaskold avatar Aug 17 '24 22:08 astakhovaskold