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

Use FormData submitter parameter #29028

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jenseng
Copy link
Contributor

@jenseng jenseng commented May 8, 2024

Summary

Fixes #29018

Rather than continuing to maintain/fix a partial polyfill (e.g. #28056), just pass the submitter to the FormData constructor, since it is now widely available. This ensures that the form data is populated consistently with a native form submission, and lets us remove a whole lot of code. This is a followup to this discussion over a year ago: https://github.com/facebook/react/pull/26674/files/5a7629ddb4f22072e37ba1ae581977ce03bdf288#r1178495317

Elaborating on that, if we're concerned about browsers that don't support it, it's important to note that:

How did you test this change?

Updated an existing test to more fully cover submitter serialization, and ran yarn test and yarn test --prod successfully.

@react-sizebot
Copy link

react-sizebot commented May 8, 2024

Comparing: 149b917...e33216e

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.66 kB 6.66 kB = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 495.01 kB 494.45 kB = 88.68 kB 88.54 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 499.81 kB 499.25 kB = 89.36 kB 89.22 kB
facebook-www/ReactDOM-prod.classic.js = 592.16 kB 591.60 kB = 104.15 kB 104.01 kB
facebook-www/ReactDOM-prod.modern.js = 568.39 kB 567.83 kB = 100.55 kB 100.41 kB
oss-experimental/react-dom/unstable_server-external-runtime.js = 8.60 kB 8.16 kB = 2.23 kB 2.16 kB
test_utils/ReactAllWarnings.js Deleted 64.26 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-dom/unstable_server-external-runtime.js = 8.60 kB 8.16 kB = 2.23 kB 2.16 kB
test_utils/ReactAllWarnings.js Deleted 64.26 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Generated by 🚫 dangerJS against e33216e

@jenseng
Copy link
Contributor Author

jenseng commented May 8, 2024

@sebmarkbage
Copy link
Collaborator

The two browsers which we support that were the main culprits before was:

  1. Safari on older iOS versions that still wasn't updated to latest version. Safari takes a surprisingly long time to actually propagate. It's not enough that an iOS version is released.
  2. Older Samsung TVs with web UIs. E.g. Facebook has TV apps on those.

Once those are confirmed, we can move to the submitter parameter.

@jenseng
Copy link
Contributor Author

jenseng commented May 8, 2024

@sebmarkbage just curious, is there a test matrix or something to automatically validate that? or is it more of a manual process/judgment call?

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.

Bug: Incorrect form data when using an image submit button
4 participants