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: b9b510d...d5cd0ec

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.68 kB 6.68 kB = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 509.94 kB 509.39 kB = 91.24 kB 91.11 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 514.88 kB 514.32 kB = 91.95 kB 91.82 kB
facebook-www/ReactDOM-prod.classic.js = 594.80 kB 594.24 kB = 104.96 kB 104.82 kB
facebook-www/ReactDOM-prod.modern.js = 585.07 kB 584.51 kB = 103.39 kB 103.25 kB
oss-experimental/react-dom/unstable_server-external-runtime.js = 8.69 kB 8.25 kB = 2.26 kB 2.18 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.69 kB 8.25 kB = 2.26 kB 2.18 kB

Generated by 🚫 dangerJS against b1117e6

@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?

@jenseng jenseng force-pushed the use-formdata-submitter branch 2 times, most recently from bb3ec87 to e33216e Compare May 16, 2024 16:11
Copy link

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions bot added the Resolution: Stale Automatically closed due to inactivity label Aug 14, 2024
@jenseng
Copy link
Contributor Author

jenseng commented Aug 14, 2024

bump

@github-actions github-actions bot removed the Resolution: Stale Automatically closed due to inactivity label Aug 14, 2024
@jenseng jenseng force-pushed the use-formdata-submitter branch from e33216e to 05f1fc3 Compare August 15, 2024 00:19
Copy link

vercel bot commented Aug 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 3, 2024 6:27pm

Copy link

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions bot added the Resolution: Stale Automatically closed due to inactivity label Nov 20, 2024
@jenseng
Copy link
Contributor Author

jenseng commented Nov 20, 2024

bump

@github-actions github-actions bot removed the Resolution: Stale Automatically closed due to inactivity label Nov 20, 2024
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