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
TanStack Form exposes field validation results by cause via errorMap (onChange, onBlur, onSubmit, etc.), which is flexible, but I’m unsure what the recommended UX pattern is when an app wants to show only one current error per field.
This feels especially difficult with form-level schema validation, because blurring one field can populate onBlur errors for other fields at the same time. Later, when the user starts editing one of those fields, that field may also get onChange validation, so multiple causes can be present in errorMap for the same field. At that point, it’s not obvious which error should be displayed to the user.
Without using onDynamic/revalidateLogic, is there an intended pattern for collapsing errorMap into one displayed field error when using form-level schemas? Or is the expectation that apps implement their own precedence / active-cause tracking on top of errorMap?
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.
-
TanStack Form exposes field validation results by cause via errorMap (onChange, onBlur, onSubmit, etc.), which is flexible, but I’m unsure what the recommended UX pattern is when an app wants to show only one current error per field.
This feels especially difficult with form-level schema validation, because blurring one field can populate onBlur errors for other fields at the same time. Later, when the user starts editing one of those fields, that field may also get onChange validation, so multiple causes can be present in errorMap for the same field. At that point, it’s not obvious which error should be displayed to the user.
Without using onDynamic/revalidateLogic, is there an intended pattern for collapsing errorMap into one displayed field error when using form-level schemas? Or is the expectation that apps implement their own precedence / active-cause tracking on top of errorMap?
Beta Was this translation helpful? Give feedback.
All reactions