final-form / final-form

🏁 Framework agnostic, high performance, subscription-based form state management

Home Page:https://final-form.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reset, restart and initialize should take InitialFormValues instead of FormValues

kkirby opened this issue · comments

reset, restart and initialize all currently accept the type FormValues, though, I would argue that it should be InitialFormValues. If you pass a partial object, then the form will be created with only some fields set, which I believe is expected. That means the object passed does not have to be an object containing all of the form values, so it should be InitialFormValues instead of FormValues.

restart:

api.reset(initialValues)

reset:

api.initialize(initialValues || {})

initialize:

final-form/src/FinalForm.js

Lines 755 to 757 in 19e66f1

if (!keepDirtyOnReinitialize) {
formState.values = values
}

Published fix in v4.20.3.