-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
When you render Field
conditionally first rendered field will override all next rendered fields
#808
Comments
Field
conditionally first rendered filed will override all next rendered fieldsField
conditionally first rendered field will override all next rendered fields
upd: You may fix it if you render it under different |
You can also "fix" it by applying a Because of that, I think the problem is that the Here, we see that the form/packages/react-form/src/useField.tsx Lines 68 to 81 in 2bebfd5
The value of form/packages/form-core/src/FieldApi.ts Lines 429 to 442 in 2bebfd5
And the field's form/packages/form-core/src/FieldApi.ts Lines 597 to 611 in 2bebfd5
In the form/packages/form-core/src/FieldApi.ts Lines 564 to 595 in 2bebfd5
|
@BenJenkinson Yep, everything works as you explained. Thank you for explanation. I haven't tried to dive into implementation. In my codebase I've fixed it with two For me it looks like unhandled I think it's worth fixing that. I may do a PR on that. Either it's worth reflecting in the doc. @crutchcorn what do you think? Do you mind if I fix it? |
Describe the bug
Use case:
I want to render different
Field
components according to some condition of formstate.values
.It used to work in previous versions (0.21=<).
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-dvwuju?file=src%2FApp.jsx
Steps to reproduce
Expected behavior
I expected that values
firstField
value will dissapear from state when you uncheck checkbox andsecondField
value will be stored in state.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Arc browser
TanStack Form adapter
react-form
TanStack Form version
v0.25.1
TypeScript version
Additional context
No response
The text was updated successfully, but these errors were encountered: