-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show hidden input errors as global errors #132
Conversation
✅ Deploy Preview for remix-forms ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Should I create an example + e2e test for this? |
|
||
let globalErrors = ([] as string[]) | ||
.concat(errors?._global || [], hiddenFieldsErrors) | ||
.filter((error) => typeof error === 'string') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some types shenanigans, I accept other ideas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are the other cases for typeof error
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If some of the previously iterated arrays turn out to be empty, there should be some [undefined, undefined]
to filter out here
80d2be4
to
7fe318a
Compare
Related issue: #10
Merges hidden field errors from any source (props, mutations, client-side validation) into global errors in order to show them to the user.