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
I have found this useful when navigating to different pages with the same form, however, the form context doesn't reset. This causes fields that subscribe to the context via useField to become out of sync with the form itself.
Describe the bug and the expected behavior
The docs provides a tip in how to reset the form by modifying the
id
passed to theuseForm
hook.https://conform.guide/api/react/useForm
I have found this useful when navigating to different pages with the same form, however, the form context doesn't reset. This causes fields that subscribe to the context via
useField
to become out of sync with the form itself.Conform version
v1.0.6
Steps to Reproduce the Bug or Issue
I created and example repo for reference: https://github.com/AMEH64/remix-spa/tree/2a5426becee6d0992ee354dfb936a9df8975d664
Create a new Remix SPA app - https://remix.run/docs/en/main/future/spa-mode
npx create-remix@latest --template remix-run/remix/templates/spa
Install Conform
npm install @conform-to/react @conform-to/zod
Create a new Conform route module
touch app/routes/conform.\$id.tsx
Create a schema for the form within
~/app/routes/conform.$id.tsx
Create a simple input component, within
~app/routes/conform.$id.tsx
, that leverages theuseField
hookCreate the route component, within
~/app/routes/conform.$id.tsx
, which leverages the route param within the form idCreate a client action, within
~/app/routes/conform.$id.tsx
, which redirects to a new route with the same formRun the app and navigate to
~/conform/1
npm run dev
Enter some text into the input and submit the form
Review the results
Expected: The fieldset/input should be associated with the new form
Actual: The fieldset/input is not associated with the new form
What browsers are you seeing the problem on?
Chrome, Others
Screenshots or Videos
Screen.Recording.2024-04-03.at.10.22.45.AM.mov
Additional context
No response
The text was updated successfully, but these errors were encountered: