You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After modifying a component that uses the useFieldContext hook, I get the following error in the web console after Vite has hot-reloaded the component:
Error: `fieldContext` only works when within a `fieldComponent` passed to `createFormHook`
at useFieldContext (@tanstack_react-form.js?v=fd612f6a:2205:13)
at TextField (TextField.tsx?t=1743182881241:24:17)
at react-stack-bottom-frame (react-dom_client.js?v=fd612f6a:16192:20)
at renderWithHooks (react-dom_client.js?v=fd612f6a:4306:24)
at updateFunctionComponent (react-dom_client.js?v=fd612f6a:5972:21)
at beginWork (react-dom_client.js?v=fd612f6a:7048:20)
at runWithFiberInDEV (react-dom_client.js?v=fd612f6a:726:18)
at performUnitOfWork (react-dom_client.js?v=fd612f6a:10831:98)
at workLoopSync (react-dom_client.js?v=fd612f6a:10692:43)
at renderRootSync (react-dom_client.js?v=fd612f6a:10675:13)
The same thing happens if you use "useFormContext".
However, this only happens when I use the recommended pattern of exposing the components via createFormHook(). If I don't provide them to createFormHook, I can use them (via <ComponentName> instead of <form.ComponentName> or <field.ComponentName>) and HMR works fine too.
Describe the bug
After modifying a component that uses the
useFieldContext
hook, I get the following error in the web console after Vite has hot-reloaded the component:Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-rg13w71d?file=src%2Fcomponents%2FFieldWrapper.tsx
Steps to reproduce
src/components/FieldWrapper.tsx
and save the fileExpected behavior
Vite reload components and show the changed component.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
TanStack Form adapter
react-form
TanStack Form version
v1.2.0
TypeScript version
v5.7.2
Additional context
No response
The text was updated successfully, but these errors were encountered: