Skip to content

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

Description

@cachemap

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions