-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
issue: useWatch / watch has wrong values when using form array with dnd kit #11909
Comments
Pretty sure it's related to this:
|
I see. Using Before:
After:
|
This PR may address this sort of issue #11522 as subscription can be established before react component. |
@bluebill1049 Can you explain how
Why does Is there any issues with doing something like this instead?
|
Version Number
7.43.9
Codesandbox/Expo snack
Codesandbox reproduction
Steps to reproduce
There are two issues happening:
useWatch
inGradeField
returnsundefined
value foradditionalInformation
and renders the component, even thoughtype
=== 'adult' and so that conditional field should be hidden completely.useWatch
in top lvl component shows unexpected values (grade
property is now existing on both form rows, while it should only be existing for one row. The values in onSubmit are correct)It seems like either
useWatch
runs earlier than expected or maybe there is a problem withkeys
(due to how drag overlay works)Given that dnd kit react is widely used and they recommend using DragOverlay, it could be really helpful to have some examples / recommendations.
Thanks in advance 🙏
Expected behaviour
useWatch
should show proper values.useWatch
should not returnundefined
for field which shouldn't even be rendered.What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: