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
Currently there are several blind spots and inconsistencies in the documentation for the setError function.
The error argument (second arg) for the function (named FieldError in the docs but ErrorOption in the TS types) is inconsistent. The docs say the type property is required while the TS type has it marked as optional
There is no indication as to what FieldError.type is used for other than an identifier. Unfortunately it seems that not setting the type property fails to merge nested errors (eg. setError('users.0.firstName', { message: 'MSG1' }) followed by setError('users.0', { message: 'MSG2' }) only the second message would be available.
The description for FieldError.types is sparse. Does it set the message to be used in case of built-in errors? Does it apply multiple messages to allow for granular access?
The description mentions "manually set one or more errors" but it's not really discussed how we could set more errors (unless this ties in with point 3). There is a section called "Multiple Errors" in the examples however it gets called for every error individually meaning that the function always sets exactly one error at a time.
It would be nice to avoid confusion on how to best set errors and avoid pitfalls like the one mentioned in point 2.
The text was updated successfully, but these errors were encountered:
Currently there are several blind spots and inconsistencies in the documentation for the setError function.
FieldError
in the docs butErrorOption
in the TS types) is inconsistent. The docs say the type property is required while the TS type has it marked as optionalsetError('users.0.firstName', { message: 'MSG1' })
followed bysetError('users.0', { message: 'MSG2' })
only the second message would be available.FieldError.types
is sparse. Does it set the message to be used in case of built-in errors? Does it apply multiple messages to allow for granular access?It would be nice to avoid confusion on how to best set errors and avoid pitfalls like the one mentioned in point 2.
The text was updated successfully, but these errors were encountered: