bug report
Getting the following error when conditionally rendering and resetting a field (subcategory) based on another field (category)
Uncaught TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at getValidators (final-form.es.js:568)
at runFieldLevelValidation (final-form.es.js:581)
// Resets the subcategory to undefined
form.change("subcategory", undefined);
// Resets the field state
form.resetFieldState("subcategory");
to work whether or not the field subcategory is mounted or not.
https://codesandbox.io/s/react-final-form-simple-example-7jt63
react 16.9.0
final-form 4.18.5
react-final-form 6.3.0
The expectations:
subcategory field only after the user make a selection on category fieldsubcategory field when the user change categorysubcategory field (to hide any validation errors or messages)Any progress on this ? The issue happened when we programatically resetting the field using hooks regardless if the field is mounted or not
Any advance? Please, a possible solution to this problem is necessary :( .
I am having this issue when trying to reset field too
(using react-admin)
resetFieldState still doesn't work
+1 resetFieldState not working for me neither on a conditional field.
My use case is that when a "parent" field value changes I want to reset the state of the depending conditional fields like they had never been interacted with.
In this case the conditional field might have never been or no longer be rendered; but it has been registered and so I would expect Final Form to imperatively perform operations on it.
This issue has been opened since Sept would be great to get a comment from maintainers so we know what we can expect.
It seems like something similar happens with FieldArrays
Most helpful comment
+1 resetFieldState not working for me neither on a conditional field.
My use case is that when a "parent" field value changes I want to reset the state of the depending conditional fields like they had never been interacted with.
In this case the conditional field might have never been or no longer be rendered; but it has been registered and so I would expect Final Form to imperatively perform operations on it.
This issue has been opened since Sept would be great to get a comment from maintainers so we know what we can expect.