Cannot subscribe to values in Next.js app
I'm having some trouble setting up a form in Next.js. I've tried following the guide in the docs and looked through issues on GitHub for some help with types. It seems to be working fine until I try to subscribe to values.
Here's the error:
And here's my best attempt at a reproduction:
https://codesandbox.io/p/devbox/tanstack-form-repro-4g3j28
3 Replies
evident-indigo•13mo ago
That seems like a problem in
mergeForm
works under the hood 🤔
Does it work if you add a field for templateId?
<form.Field name="templateId">
foreign-sapphireOP•13mo ago
@Leonardo Thanks! That was an oversight on the
name
prop. But it didn't get it working, unfortunately. What does seem to work is changing the selector from (values) => values.templateId
to (values) => values?.templateId
evident-indigo•13mo ago
What I tried instead was showing a nice
JSON.stringify(values)
and I noticed all fields were missing 😄
All fields not having a mounted component, to be precise