-
-
Notifications
You must be signed in to change notification settings - Fork 492
Open
Description
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
Field are unregistered, causing meta data (dirty/valid/etc) to be lost, when they are removed from the DOM. The meta data is regained once the field is brought back into the DOM.
See the code sandbox attached for how the Button cannot property stay enabled when the collapsible panel has been closed once a field value is adjusted.
Steps to reproduce:
- Open "Address" panel, then type in any value. Notice that the button is now enabled.
- Collapse "Address" panel.
Notice that:
- the button is now disabled even though fields have been modified.
- form is considered pristine even though fields have been modified.
- "dirtyFields/visited/modified/touched" under form state is empty though address was modified
- Open "Address" panel.
Notice that:
- expected form states comes back
- button is now property enabled
What is the expected behavior?
Fields remain registered upon removal from the DOM, ensuring other subscribers access to it and the form's values and meta states.
Removing elements from the DOM when not in view can be to optimize view performance; it is not necessarily an intent to remove the field from the form.
Sandbox Link
https://codesandbox.io/s/expansion-panel-with-field-zusgx
What's your environment?
react-final-form: 6.3.0
final form: 4.18.5
MikeWinter, mmircea16, SpadarShut, faneder, 7rulnik and 8 more
Metadata
Metadata
Assignees
Labels
No labels