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
Whenever I reach for getFieldState is in a place I use form.getValues. Getting values does not require render subscription. Is it possible to make getFieldState behave the same? Is it possible to gurantee that getFieldState is in sync with getValues? I currently use getValues, but have to wait for a re-render to get latest valid state, or I have to opt to re-running expensive form.trigger validation.
Another place is in a dependent validation in field Y. In this config I get the value of field X, but if it's not valid, I want to ignore:
const FieldYConfig = {
validate: {
isDoubleX: value => {
const x = form.getValues('x');
const isXValid = form.getFieldState('x'); // This does not work
if (!isXValid) {
return 'X must be valid first';
}
}
}
}
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.
-
Whenever I reach for
getFieldState
is in a place I useform.getValues
. Getting values does not require render subscription. Is it possible to makegetFieldState
behave the same? Is it possible to gurantee thatgetFieldState
is in sync withgetValues
? I currently use getValues, but have to wait for a re-render to get latest valid state, or I have to opt to re-running expensiveform.trigger
validation.Another place is in a dependent validation in field Y. In this config I get the value of field X, but if it's not valid, I want to ignore:
Beta Was this translation helpful? Give feedback.
All reactions