react-final-form icon indicating copy to clipboard operation
react-final-form copied to clipboard

Radio button remains dirty after submit because `initialValue` does not update to newly saved value despite `initialValue` prop changing

Open cachemap opened this issue 3 years ago • 0 comments

Are you submitting a bug report or a feature request?

Bug Report

What is the current behavior?

Submitting a form with 2 radio button <Field>s results in the radio button state being considered "dirty" after submit succeeds. The form's initialValues shows the old/previous value despite the initialValue prop on both radio button <Field>s being changed after the submit completes.

What is the expected behavior?

Given an initial form state of:

{ section-one: { radio-button: "A" } }

Given radio buttons initialized like so: A) (selected) B)

And a change by the user to:

A) B) (selected)

Upon clicking "Submit", B would remain as the selected radio button, and the form's dirty state would be false because section-one.radio-button would not be considered dirty.

(Currently, it would be considered dirty because the initial[name] would show as being the "old" value instead of the newly saved one.)

Sandbox Link

(Coming soon, hopefully!)

What's your environment?

[email protected] [email protected] Windows 10

Other information

cachemap avatar Apr 29 '22 23:04 cachemap