Skip to content
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

Merged
merged 5 commits into from
Dec 13, 2022

Conversation

felipefreitag
Copy link
Contributor

@felipefreitag felipefreitag commented Dec 13, 2022

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.

@netlify
Copy link

netlify bot commented Dec 13, 2022

Deploy Preview for remix-forms ready!

Name Link
🔨 Latest commit 0331aed
🔍 Latest deploy log https://app.netlify.com/sites/remix-forms/deploys/6398d5078640a20009c5afc0
😎 Deploy Preview https://deploy-preview-132--remix-forms.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@felipefreitag
Copy link
Contributor Author

Should I create an example + e2e test for this?


let globalErrors = ([] as string[])
.concat(errors?._global || [], hiddenFieldsErrors)
.filter((error) => typeof error === 'string')
Copy link
Contributor Author

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

Copy link
Contributor

@diogob diogob Dec 13, 2022

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?

Copy link
Contributor Author

@felipefreitag felipefreitag Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, undefined

Copy link
Contributor Author

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

@diogob diogob force-pushed the show-hidden-input-errors branch from 80d2be4 to 7fe318a Compare December 13, 2022 19:07
@felipefreitag felipefreitag marked this pull request as ready for review December 13, 2022 19:40
@felipefreitag felipefreitag merged commit 0522743 into main Dec 13, 2022
@felipefreitag felipefreitag deleted the show-hidden-input-errors branch December 13, 2022 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants