final-form / final-form/react-final-form

reset with keepDirtyOnReinitialize

Open
#670 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

### Are you submitting a **bug report** or a **feature request**?

feature request / bug report (could be either one depending on point of view...)

### What is the current behavior?

I'm using `keepDirtyOnReinitialize` because some initial values are loaded asynchronously while the user could have already started to fill in the form.
Once they submit it, I would like to reset the form to create a new entity (same page).
Calling `form.reset()` or `form.initialize(initialValues)` has no effect.

### What is the expected behavior?

I think `form.reset()` should work wether `keepDirtyOnReinitialize` is set or not.
Otherwise maybe allow something like `form.reset(true)` or `form.forceReset()`.

### Sandbox Link

https://codesandbox.io/s/react-final-form-keepdirtyonreinitialize-reset-4hnn7

### What's your environment?

react-final-form@6.3.0
final-form@4.18.5
Chrome/macOS

### Other information

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.