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

fix(react-router-dom): fix submitter serialization (alt approach) #9866

Closed
wants to merge 1 commit into from

Conversation

jenseng
Copy link
Contributor

@jenseng jenseng commented Jan 10, 2023

🔈 NOTE: I have two proposed fixes; this is the alternate one, the primary proposal is #9865. This PR is the RR port of remix-run/remix#4475. 🔈

Bring <Form> submissions in line with the spec with respect to how and where form submitters are serialized within the data set. We accomplish this by constructing the form data set ourselves according to the spec.

Problems fixed:

  1. Serialize submitters in tree order (i.e. where they appear in the DOM)
  2. Serialize Image Button submitter correctly (i.e. separate x and y coordinate entries, rather than a single empty entry)
  3. Stop sending multiple entries in older WebKit

Notes: required a couple more jsdom polyfills in order to test it, but we should be able to upgrade and remove those soon 🤞

References: remix-run/remix#4342
Spec: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-form-data-set

@changeset-bot
Copy link

changeset-bot bot commented Jan 10, 2023

🦋 Changeset detected

Latest commit: ecf4c77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
react-router Patch
react-router-dom Patch
react-router-dom-v5-compat Patch
react-router-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This is the RR port of remix-run/remix#4475

Bring `<Form>` submissions in line with the spec with respect to how and where
form submitters are serialized within the data set. We accomplish this by
constructing the form data set ourselves according to the spec.

Problems fixed:
1. Serialize submitters in tree order (i.e. where they appear in the DOM)
2. Serialize Image Button submitter correctly (i.e. separate x and y coordinate
   entries, rather than a single empty entry)
3. Stop sending multiple entries in older WebKit

References: remix-run/remix#4342
Spec: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-form-data-set
@jenseng
Copy link
Contributor Author

jenseng commented Jan 25, 2023

Closing this in favor of #9865 (which will likely end up much simpler too, since it looks like submitter will be added to the FormData constructor 🥳 )

@jenseng jenseng closed this Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant