Skip to content
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

Maintaining complete form state after unmount #992

Open
made-in-nz opened this issue May 11, 2022 · 1 comment
Open

Maintaining complete form state after unmount #992

made-in-nz opened this issue May 11, 2022 · 1 comment

Comments

@made-in-nz
Copy link

Are you submitting a bug report or a feature request?

Feature request

What is the current behavior?

I'm migrating our front-end infrastructure from redux-form, where we have projects with multiple forms with destroyOnUnmount={false} set on the (redux-form) Form.
In my apps we have wizard type processes, and other CRUD type apps where a record is displayed across multiple tabs with a form used on each tab. To easily visualise a page/tab's validation state I find it convenient to have distinct forms for each.
In redux-form, the complete form state persists in the redux store when destroyOnUnmount={false} is set, which means when remounting the form component the complete state is rehydrated (visited, touched, error, etc).

Wondering what is the approach to achieve this using react-final-form?

What's your environment?

"final-form": "^4.20.7",
"react": "^18.1.0",  
"react-dom": "^18.1.0",
"react-final-form": "^6.5.9",
@georgiosd
Copy link

For our wizards, I keep every step mounted and only show the relevant form.

I guess you could also use a spy to save the state somewhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants