Skip to content

Commit

Permalink
[fizz] fix empty string href double warning (#31783)
Browse files Browse the repository at this point in the history
I think this is the suggested change from
#31765 (comment)

But no tests fail and I'm not sure how to test it? Seems sus.

Also seems like the `removeAttribute` here should be changed?

https://github.com/facebook/react/blob/9d9f12f2699a049777fa88914306ad4de9e2b74d/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L400-L427

DiffTrain build for [bf883be](bf883be)
  • Loading branch information
rickhanlonii committed Jan 3, 2025
1 parent ea06e7b commit 2b7d8cd
Show file tree
Hide file tree
Showing 23 changed files with 178 additions and 158 deletions.
2 changes: 1 addition & 1 deletion compiled-rn/VERSION_NATIVE_FB
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.1.0-native-fb-3b009b4c-20250102
19.1.0-native-fb-bf883beb-20250103
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<9bd134138f5b06cd767f897c60d22200>>
* @generated SignedSource<<842b059f8fdd61080f90aabcf7208a9c>>
*/

"use strict";
Expand Down Expand Up @@ -420,5 +420,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3b009b4c-20250102";
exports.version = "19.1.0-native-fb-bf883beb-20250103";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<0948aeab04f6f5ed7045a019b211bcec>>
* @generated SignedSource<<78d730b6659ff6543505d3fc8d2af426>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3b009b4c-20250102";
exports.version = "19.1.0-native-fb-bf883beb-20250103";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<0948aeab04f6f5ed7045a019b211bcec>>
* @generated SignedSource<<78d730b6659ff6543505d3fc8d2af426>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3b009b4c-20250102";
exports.version = "19.1.0-native-fb-bf883beb-20250103";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<03613344aa6068afaba47c44eeaf2e5f>>
* @generated SignedSource<<78486249bde5c057c1694badd22987eb>>
*/

/*
Expand Down Expand Up @@ -12713,7 +12713,9 @@ __DEV__ &&
if (
((hoistableRoot = maybeNodes[i]),
hoistableRoot.getAttribute("href") ===
(null == current.href ? null : current.href) &&
(null == current.href || "" === current.href
? null
: current.href) &&
hoistableRoot.getAttribute("rel") ===
(null == current.rel ? null : current.rel) &&
hoistableRoot.getAttribute("title") ===
Expand Down Expand Up @@ -19702,36 +19704,34 @@ __DEV__ &&
}
case "src":
case "href":
"" !== propKey ||
("a" === tag && "href" === value) ||
("object" === tag && "data" === value)
? hydrateSanitizedAttribute(
domElement,
value,
value,
propKey,
extraAttributes,
serverDifferences
)
: ("src" === value
? error$jscomp$0(
'An empty string ("") was passed to the %s attribute. This may cause the browser to download the whole page again over the network. To fix this, either do not render the element at all or pass null to %s instead of an empty string.',
value,
value
)
: error$jscomp$0(
'An empty string ("") was passed to the %s attribute. To fix this, either do not render the element at all or pass null to %s instead of an empty string.',
value,
value
),
hydrateSanitizedAttribute(
domElement,
value,
value,
null,
extraAttributes,
serverDifferences
));
if (
!(
"" !== propKey ||
("a" === tag && "href" === value) ||
("object" === tag && "data" === value)
)
) {
"src" === value
? error$jscomp$0(
'An empty string ("") was passed to the %s attribute. This may cause the browser to download the whole page again over the network. To fix this, either do not render the element at all or pass null to %s instead of an empty string.',
value,
value
)
: error$jscomp$0(
'An empty string ("") was passed to the %s attribute. To fix this, either do not render the element at all or pass null to %s instead of an empty string.',
value,
value
);
continue;
}
hydrateSanitizedAttribute(
domElement,
value,
value,
propKey,
extraAttributes,
serverDifferences
);
continue;
case "action":
case "formAction":
Expand Down Expand Up @@ -20341,7 +20341,9 @@ __DEV__ &&
else if (
name !== anyProps.rel ||
instance.getAttribute("href") !==
(null == anyProps.href ? null : anyProps.href) ||
(null == anyProps.href || "" === anyProps.href
? null
: anyProps.href) ||
instance.getAttribute("crossorigin") !==
(null == anyProps.crossOrigin
? null
Expand Down Expand Up @@ -25886,11 +25888,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-native-fb-3b009b4c-20250102" !== isomorphicReactPackageVersion)
if ("19.1.0-native-fb-bf883beb-20250103" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.1.0-native-fb-3b009b4c-20250102\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-native-fb-bf883beb-20250103\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -25927,10 +25929,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-native-fb-3b009b4c-20250102",
version: "19.1.0-native-fb-bf883beb-20250103",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3b009b4c-20250102"
reconcilerVersion: "19.1.0-native-fb-bf883beb-20250103"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -26076,5 +26078,5 @@ __DEV__ &&
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.1.0-native-fb-3b009b4c-20250102";
exports.version = "19.1.0-native-fb-bf883beb-20250103";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4ed2f264bde385ff618b27f469c22dc6>>
* @generated SignedSource<<23e2e841a1b6664968af2b4e878e76b3>>
*/

/*
Expand Down Expand Up @@ -8876,7 +8876,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
if (
((currentResource = maybeNodes[i]),
currentResource.getAttribute("href") ===
(null == current.href ? null : current.href) &&
(null == current.href || "" === current.href
? null
: current.href) &&
currentResource.getAttribute("rel") ===
(null == current.rel ? null : current.rel) &&
currentResource.getAttribute("title") ===
Expand Down Expand Up @@ -14258,7 +14260,9 @@ function canHydrateInstance(instance, type, props, inRootOrSingleton) {
else if (
name !== anyProps.rel ||
instance.getAttribute("href") !==
(null == anyProps.href ? null : anyProps.href) ||
(null == anyProps.href || "" === anyProps.href
? null
: anyProps.href) ||
instance.getAttribute("crossorigin") !==
(null == anyProps.crossOrigin ? null : anyProps.crossOrigin) ||
instance.getAttribute("title") !==
Expand Down Expand Up @@ -15904,14 +15908,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1754 = React.version;
if (
"19.1.0-native-fb-3b009b4c-20250102" !==
"19.1.0-native-fb-bf883beb-20250103" !==
isomorphicReactPackageVersion$jscomp$inline_1754
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1754,
"19.1.0-native-fb-3b009b4c-20250102"
"19.1.0-native-fb-bf883beb-20250103"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -15933,10 +15937,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2202 = {
bundleType: 0,
version: "19.1.0-native-fb-3b009b4c-20250102",
version: "19.1.0-native-fb-bf883beb-20250103",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3b009b4c-20250102"
reconcilerVersion: "19.1.0-native-fb-bf883beb-20250103"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2203 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16042,4 +16046,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.1.0-native-fb-3b009b4c-20250102";
exports.version = "19.1.0-native-fb-bf883beb-20250103";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<77dbda27b5049a4b3f2def588adb6ecc>>
* @generated SignedSource<<001f82612dd6516892d9622df8967ece>>
*/

/*
Expand Down Expand Up @@ -9271,7 +9271,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
if (
((hoistableRoot = maybeNodes[i]),
hoistableRoot.getAttribute("href") ===
(null == current.href ? null : current.href) &&
(null == current.href || "" === current.href
? null
: current.href) &&
hoistableRoot.getAttribute("rel") ===
(null == current.rel ? null : current.rel) &&
hoistableRoot.getAttribute("title") ===
Expand Down Expand Up @@ -14897,7 +14899,9 @@ function canHydrateInstance(instance, type, props, inRootOrSingleton) {
else if (
name !== anyProps.rel ||
instance.getAttribute("href") !==
(null == anyProps.href ? null : anyProps.href) ||
(null == anyProps.href || "" === anyProps.href
? null
: anyProps.href) ||
instance.getAttribute("crossorigin") !==
(null == anyProps.crossOrigin ? null : anyProps.crossOrigin) ||
instance.getAttribute("title") !==
Expand Down Expand Up @@ -16551,14 +16555,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1849 = React.version;
if (
"19.1.0-native-fb-3b009b4c-20250102" !==
"19.1.0-native-fb-bf883beb-20250103" !==
isomorphicReactPackageVersion$jscomp$inline_1849
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1849,
"19.1.0-native-fb-3b009b4c-20250102"
"19.1.0-native-fb-bf883beb-20250103"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -16580,10 +16584,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_1856 = {
bundleType: 0,
version: "19.1.0-native-fb-3b009b4c-20250102",
version: "19.1.0-native-fb-bf883beb-20250103",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3b009b4c-20250102",
reconcilerVersion: "19.1.0-native-fb-bf883beb-20250103",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$294 = 0;
Expand Down Expand Up @@ -16704,4 +16708,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.1.0-native-fb-3b009b4c-20250102";
exports.version = "19.1.0-native-fb-bf883beb-20250103";
Loading

0 comments on commit 2b7d8cd

Please sign in to comment.