-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
Since v0.0.15, FieldApi reflects Field values but not FormApi #437
Comments
I'm reasonably certain this isn't really a bug with TanStack Form 😅 What happens if you do not use object destructuring on |
Hmm no wait nevermind. There's absolutely something wrong with |
I've come to realize that useForm does not support destructuring. That's my oversight, and I apologize. I've treated it as an object now, but it doesn't seem to be reflected in onSubmit. I apologize for the inconvenience this may have caused. Thank you for your continued support. If you need any more information, please feel free to comment, and I will provide it.
|
No inconvenience - I appreciate you filing this! :) I think I've already identified this issue: https://github.com/TanStack/form/blob/main/packages/react-form/src/useForm.tsx#L79-L81 This triggers every time due to The temporary workaround is to wrap your const form = useForm(useMemo(() => ({
defaultValues: {
return {
label: '',
}
},
onSubmit: async (values) => {
console.log(values)
},
}), []) |
Thank you so much!!! I appreciate your quick identification of the issue.
|
@Toru-Takagi we have a potential long-term fix in PR #440, but it has some API changes that are rather unorthodox. I want to get some feedback from the rest of the team before moving forward with merging it. Expect to hear more news Tuesday or Wednesday |
Thank you very much for your prompt response. |
Here's the good news @Toru-Takagi: this should now be fixed in 0.1.2 Here's the better news: No more Please let us know if you run into any further issues and thank you for reporting! |
Thanks for the fix 🙇
This is very good news.
Glad to be of service. |
Describe the bug
This is the issue we have reported here.
#430 (comment)
console.log(field)
※A Compound
console.log(store)
※A Compound
console.log(state)
※A Compound
console.log(values)
Simple code that occurs with the use of Next.
Your minimal, reproducible example
Described in the description
Steps to reproduce
Expected behavior
The values argument of onSubmit should reflect what was entered into the Field.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
Tanstack Form adapter
None
TanStack Form version
v0.0.15
TypeScript version
v5.1.6
Additional context
No response
The text was updated successfully, but these errors were encountered: