You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
field.handleChange(undefined); // line 171
// and the alternatives...
field.setValue(undefined);
form.resetField("schedule", {
type: "once",
// runDate omitted
});
all mean "reset the runDate to the default value", not to undefined, even though undefined (or omitted) has a legitimate meaning.
What's the rationale behind that decision? (instead of being explicit with reset in the API, for example)
Is there a recommended approach one should consider in this situation--where the aim is to set the value to undefined rather than to the default value?
I suppose one approach would be to set the defaultValues to a value whose "clearable" props—the ones you want to be able to omit or to set to undefined—are cleared initially:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
continued from this issue
(with reference to this codesandbox)
If I understand correctly, then essentially
all mean "reset the runDate to the default value", not to undefined, even though undefined (or omitted) has a legitimate meaning.
What's the rationale behind that decision? (instead of being explicit with reset in the API, for example)
Is there a recommended approach one should consider in this situation--where the aim is to set the value to undefined rather than to the default value?
I suppose one approach would be to set the defaultValues to a value whose "clearable" props—the ones you want to be able to omit or to set to undefined—are cleared initially:
and then to set the actual value you want to show in a useEffect
but this seems obscure, at best.
edited: for clarity
Beta Was this translation helpful? Give feedback.
All reactions