-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Insert temporary input node to polyfill submitter argument in FormData #26714
Conversation
When I moved the other part I broke out of this validation too early.
Comparing: 2fa6323...1d7418a Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
We also exclude the submitter if it's a function action. This ensures that we don't include the generated "name" when the action is a server action.
3469b8a
to
6b56558
Compare
@@ -53,6 +53,11 @@ function extractEvents( | |||
if (submitterAction != null) { | |||
// The submitter overrides the form action. | |||
action = submitterAction; | |||
if (typeof action === 'function') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is if (typeof action !== 'function')
just below… skip this conditional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I ended up doing in the replaying one. Not sure why I didn't see it here.
// TODO: FormData takes a second argument that it's the submitter but this | ||
// is fairly new so not all browsers support it yet. Switch to that technique | ||
// when available. | ||
const type = submitter.type; | ||
submitter.type = 'hidden'; | ||
const temp = submitter.ownerDocument.createElement('input'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think adding .type = 'hidden'
to the temp node is any more efficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean because it won't invalidate layout or something? Not sure that's true since even hidden forms can be made to participate in layout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also invalid on button so wouldn't make any difference in most cases.
If this is false, we'll bail anyway.
facebook#26714) Insert temporary input node to polyfill submitter argument in FormData. This works for buttons too and fixes a bug where the type attribute wasn't reset. I also exclude the submitter if it's a function action. This ensures that we don't include the generated "name" when the action is a server action. Conceptually that name doesn't exist.
#26714) Insert temporary input node to polyfill submitter argument in FormData. This works for buttons too and fixes a bug where the type attribute wasn't reset. I also exclude the submitter if it's a function action. This ensures that we don't include the generated "name" when the action is a server action. Conceptually that name doesn't exist. DiffTrain build for commit 5e5342b.
Insert temporary input node to polyfill submitter argument in FormData. This works for buttons too and fixes a bug where the type attribute wasn't reset.
I also exclude the submitter if it's a function action. This ensures that we don't include the generated "name" when the action is a server action. Conceptually that name doesn't exist.