Skip to content

Commit

Permalink
[Fizz] Check for nullish values on ReactCustomFormAction (#26770)
Browse files Browse the repository at this point in the history
Usually we don't have to do this since we only set these in the loop but
the ReactCustomFormAction props are optional so they might be undefined.

Also moved it to a general type since it's a semi-public API.

DiffTrain build for [fa7a447](fa7a447)
  • Loading branch information
sebmarkbage committed May 3, 2023
1 parent 098e6fd commit a746b80
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b7972822b5887d05ae772ef757a453265b4b7aec
fa7a447b9ce5a4f0be592fc2946380b0fa3b29c0
20 changes: 10 additions & 10 deletions compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-classic-7f904b45";
var ReactVersion = "18.3.0-www-classic-e6e6835d";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -2885,23 +2885,23 @@ function pushFormActionAttribute(
) {
var formData = null;

if (name !== null) {
if (name != null) {
pushAttribute(target, "name", name);
}

if (formAction !== null) {
if (formAction != null) {
pushAttribute(target, "formAction", formAction);
}

if (formEncType !== null) {
if (formEncType != null) {
pushAttribute(target, "formEncType", formEncType);
}

if (formMethod !== null) {
if (formMethod != null) {
pushAttribute(target, "formMethod", formMethod);
}

if (formTarget !== null) {
if (formTarget != null) {
pushAttribute(target, "formTarget", formTarget);
}

Expand Down Expand Up @@ -3560,19 +3560,19 @@ function pushStartForm(target, props, responseState) {
}
}

if (formAction !== null) {
if (formAction != null) {
pushAttribute(target, "action", formAction);
}

if (formEncType !== null) {
if (formEncType != null) {
pushAttribute(target, "encType", formEncType);
}

if (formMethod !== null) {
if (formMethod != null) {
pushAttribute(target, "method", formMethod);
}

if (formTarget !== null) {
if (formTarget != null) {
pushAttribute(target, "target", formTarget);
}

Expand Down
20 changes: 10 additions & 10 deletions compiled/facebook-www/ReactDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-modern-45591960";
var ReactVersion = "18.3.0-www-modern-0f7d86b7";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -2885,23 +2885,23 @@ function pushFormActionAttribute(
) {
var formData = null;

if (name !== null) {
if (name != null) {
pushAttribute(target, "name", name);
}

if (formAction !== null) {
if (formAction != null) {
pushAttribute(target, "formAction", formAction);
}

if (formEncType !== null) {
if (formEncType != null) {
pushAttribute(target, "formEncType", formEncType);
}

if (formMethod !== null) {
if (formMethod != null) {
pushAttribute(target, "formMethod", formMethod);
}

if (formTarget !== null) {
if (formTarget != null) {
pushAttribute(target, "formTarget", formTarget);
}

Expand Down Expand Up @@ -3560,19 +3560,19 @@ function pushStartForm(target, props, responseState) {
}
}

if (formAction !== null) {
if (formAction != null) {
pushAttribute(target, "action", formAction);
}

if (formEncType !== null) {
if (formEncType != null) {
pushAttribute(target, "encType", formEncType);
}

if (formMethod !== null) {
if (formMethod != null) {
pushAttribute(target, "method", formMethod);
}

if (formTarget !== null) {
if (formTarget != null) {
pushAttribute(target, "target", formTarget);
}

Expand Down
20 changes: 10 additions & 10 deletions compiled/facebook-www/ReactDOMServer-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ function pushFormActionAttribute(
formTarget,
name
) {
null !== name && pushAttribute(target, "name", name);
null !== formAction && pushAttribute(target, "formAction", formAction);
null !== formEncType && pushAttribute(target, "formEncType", formEncType);
null !== formMethod && pushAttribute(target, "formMethod", formMethod);
null !== formTarget && pushAttribute(target, "formTarget", formTarget);
null != name && pushAttribute(target, "name", name);
null != formAction && pushAttribute(target, "formAction", formAction);
null != formEncType && pushAttribute(target, "formEncType", formEncType);
null != formMethod && pushAttribute(target, "formMethod", formMethod);
null != formTarget && pushAttribute(target, "formTarget", formTarget);
return null;
}
function pushAttribute(target, name, value) {
Expand Down Expand Up @@ -1013,10 +1013,10 @@ function pushStartInstance(
default:
pushAttribute(target, name, propKey$jscomp$0);
}
null !== propValue && pushAttribute(target, "action", propValue);
null !== resources && pushAttribute(target, "encType", resources);
null !== selected && pushAttribute(target, "method", selected);
null !== propValue$jscomp$0 &&
null != propValue && pushAttribute(target, "action", propValue);
null != resources && pushAttribute(target, "encType", resources);
null != selected && pushAttribute(target, "method", selected);
null != propValue$jscomp$0 &&
pushAttribute(target, "target", propValue$jscomp$0);
target.push(">");
pushInnerHTML(target, textEmbedded, responseState);
Expand Down Expand Up @@ -4002,4 +4002,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "18.3.0-www-classic-f0c37f65";
exports.version = "18.3.0-www-classic-42ee674f";
20 changes: 10 additions & 10 deletions compiled/facebook-www/ReactDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ function pushFormActionAttribute(
formTarget,
name
) {
null !== name && pushAttribute(target, "name", name);
null !== formAction && pushAttribute(target, "formAction", formAction);
null !== formEncType && pushAttribute(target, "formEncType", formEncType);
null !== formMethod && pushAttribute(target, "formMethod", formMethod);
null !== formTarget && pushAttribute(target, "formTarget", formTarget);
null != name && pushAttribute(target, "name", name);
null != formAction && pushAttribute(target, "formAction", formAction);
null != formEncType && pushAttribute(target, "formEncType", formEncType);
null != formMethod && pushAttribute(target, "formMethod", formMethod);
null != formTarget && pushAttribute(target, "formTarget", formTarget);
return null;
}
function pushAttribute(target, name, value) {
Expand Down Expand Up @@ -1012,10 +1012,10 @@ function pushStartInstance(
default:
pushAttribute(target, name, propKey$jscomp$0);
}
null !== propValue && pushAttribute(target, "action", propValue);
null !== resources && pushAttribute(target, "encType", resources);
null !== selected && pushAttribute(target, "method", selected);
null !== propValue$jscomp$0 &&
null != propValue && pushAttribute(target, "action", propValue);
null != resources && pushAttribute(target, "encType", resources);
null != selected && pushAttribute(target, "method", selected);
null != propValue$jscomp$0 &&
pushAttribute(target, "target", propValue$jscomp$0);
target.push(">");
pushInnerHTML(target, textEmbedded, responseState);
Expand Down Expand Up @@ -3900,4 +3900,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "18.3.0-www-modern-5e9b2f5f";
exports.version = "18.3.0-www-modern-a116db68";
18 changes: 9 additions & 9 deletions compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -2892,23 +2892,23 @@ function pushFormActionAttribute(
) {
var formData = null;

if (name !== null) {
if (name != null) {
pushAttribute(target, "name", name);
}

if (formAction !== null) {
if (formAction != null) {
pushAttribute(target, "formAction", formAction);
}

if (formEncType !== null) {
if (formEncType != null) {
pushAttribute(target, "formEncType", formEncType);
}

if (formMethod !== null) {
if (formMethod != null) {
pushAttribute(target, "formMethod", formMethod);
}

if (formTarget !== null) {
if (formTarget != null) {
pushAttribute(target, "formTarget", formTarget);
}

Expand Down Expand Up @@ -3567,19 +3567,19 @@ function pushStartForm(target, props, responseState) {
}
}

if (formAction !== null) {
if (formAction != null) {
pushAttribute(target, "action", formAction);
}

if (formEncType !== null) {
if (formEncType != null) {
pushAttribute(target, "encType", formEncType);
}

if (formMethod !== null) {
if (formMethod != null) {
pushAttribute(target, "method", formMethod);
}

if (formTarget !== null) {
if (formTarget != null) {
pushAttribute(target, "target", formTarget);
}

Expand Down
18 changes: 9 additions & 9 deletions compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ function pushFormActionAttribute(
formTarget,
name
) {
null !== name && pushAttribute(target, "name", name);
null !== formAction && pushAttribute(target, "formAction", formAction);
null !== formEncType && pushAttribute(target, "formEncType", formEncType);
null !== formMethod && pushAttribute(target, "formMethod", formMethod);
null !== formTarget && pushAttribute(target, "formTarget", formTarget);
null != name && pushAttribute(target, "name", name);
null != formAction && pushAttribute(target, "formAction", formAction);
null != formEncType && pushAttribute(target, "formEncType", formEncType);
null != formMethod && pushAttribute(target, "formMethod", formMethod);
null != formTarget && pushAttribute(target, "formTarget", formTarget);
return null;
}
function pushAttribute(target, name, value) {
Expand Down Expand Up @@ -1032,10 +1032,10 @@ function pushStartInstance(
default:
pushAttribute(target, name, propKey$jscomp$0);
}
null !== propValue && pushAttribute(target, "action", propValue);
null !== resources && pushAttribute(target, "encType", resources);
null !== selected && pushAttribute(target, "method", selected);
null !== propValue$jscomp$0 &&
null != propValue && pushAttribute(target, "action", propValue);
null != resources && pushAttribute(target, "encType", resources);
null != selected && pushAttribute(target, "method", selected);
null != propValue$jscomp$0 &&
pushAttribute(target, "target", propValue$jscomp$0);
target.push(">");
pushInnerHTML(target, textEmbedded, responseState);
Expand Down

0 comments on commit a746b80

Please sign in to comment.