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

Add guard clause to return valid empty form data #354

Merged

Conversation

julianrubisch
Copy link
Contributor

Bug fix

Description

After a lot of headache @marcoroth and me found out that new FormData(null) throws an error in Chrome, but does not in safari.

The closest('form') call in stimulate would return null in case no form is present up the DOM hierarchy, blowing up serializeForm, but just on Chrome 😂

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing
  • This is not a documentation update

@julianrubisch julianrubisch force-pushed the opt-in-form-serialization branch from f0a9f44 to c597b6c Compare November 6, 2020 16:19
@julianrubisch julianrubisch force-pushed the opt-in-form-serialization branch from c597b6c to 8706c96 Compare November 6, 2020 16:21
@jonathan-s
Copy link
Contributor

Throws an error in firefox as well. So fixes it for firefox too.

@marcoroth
Copy link
Member

Yeah, also throws an error in Opera. Seems like Safari is just a little bit more forgiving 🙈

@marcoroth
Copy link
Member

@jonathan-s
Copy link
Contributor

I'd be happy to volunteer some help to set up cypress. It could have helped in a situation like this. I'd need some help on the rails part to get started though.

@julianrubisch
Copy link
Contributor Author

@ParamagicDev is our man for Cypress 😎

@leastbad leastbad merged commit 4301f2e into stimulusreflex:master Nov 7, 2020
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.

4 participants