Skip to content

Conditional fields lose their value when not present #452

@dan-gamble

Description

@dan-gamble

Describe the bug and the expected behavior

If an element disappears from the form it's value is then wiped from the form.value.

I'd built quite a deeply nested tab-based form and discovered that when React removes an element from the DOM then conform also removes that value from form.value. I'd expect the data to stay as it was in the last state before the element was removed from the DOM.

Conform version

v1.0.1

Steps to Reproduce the Bug or Issue

  1. Go to the sandbox
  2. Change the dropdown to a different value
  3. See that the bike or car object is removed from the form.value

For the sake of this demo I've used a select but this was initially discovered when I was using tabs

What browsers are you seeing the problem on?

Chrome, Firefox, Microsoft Edge, Safari, Others

Screenshots or Videos

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions