issue: append or delete creates duplicates while using react-virtuoso #12453
Replies: 7 comments
-
Tested a few other versions up to 7.12.0. Issue is not there. |
Beta Was this translation helpful? Give feedback.
-
I have tested various versions. This issue appears on version react-hook-form/src/useFieldArray.ts Lines 301 to 302 in a4b2c0a |
Beta Was this translation helpful? Give feedback.
-
if you could provide an example of the issue with native input without external dependency or test case without the external lib dep. |
Beta Was this translation helpful? Give feedback.
-
@calcifer9000 For now, you can try the workaround discussed here, probably same issue: |
Beta Was this translation helpful? Give feedback.
-
The issue appearance also makes sense considering the explanation @leapful provided. Seems to be an issue involving react-virtuoso logic and controlled components |
Beta Was this translation helpful? Give feedback.
-
This is actually the source of my forked codesandbox, where it is working because of version 7.0.5. The workaround in this codesandbox is not necessary, they simply weren't using react-virtuoso correctly with react-hook-form. They just have to add ComputeItemKey, and their workaround is no longer necessary, nor did the workaround actually work, as to why I came to conclusion that it was a version issue. |
Beta Was this translation helpful? Give feedback.
-
The workaround really didn't work correctly in version 7.0.5, but seems to work on newer versions like 7.53.2; I created a codesandbox to demonstrate: https://codesandbox.io/p/sandbox/fieldarraytablevirtuoso-forked-cmlg7h Still, as you said, I don't think it can be considered a correct implementation of react-virtuoso with react-hook-form, that's why I called it a workaround; |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Number
7.53.1
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/fieldarraytablevirtuoso-forked-qp5n2q
Steps to reproduce
Expected behaviour
It should not be duplicating an append. It should not require multiple deletion to delete an input
Note: Change react-hook-form version to 7.0.5 and the issue goes away. I do not know where the issue starts.
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions