Skip to content

Commit 72bde5d

Browse files
committedJan 3, 2025·
[fizz] fix empty string href double warning (#31783)
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)
1 parent 8242ee3 commit 72bde5d

34 files changed

+258
-226
lines changed
 

‎compiled/facebook-www/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3b009b4cd58d382cfde2a72232c87df1a34d56d5
1+
bf883bebbc4973dea0e4801a5a62f82043ff57ee
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3b009b4cd58d382cfde2a72232c87df1a34d56d5
1+
bf883bebbc4973dea0e4801a5a62f82043ff57ee

‎compiled/facebook-www/React-dev.classic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ __DEV__ &&
19421942
exports.useTransition = function () {
19431943
return resolveDispatcher().useTransition();
19441944
};
1945-
exports.version = "19.1.0-www-classic-3b009b4c-20250102";
1945+
exports.version = "19.1.0-www-classic-bf883beb-20250103";
19461946
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19471947
"function" ===
19481948
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

‎compiled/facebook-www/React-dev.modern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ __DEV__ &&
19421942
exports.useTransition = function () {
19431943
return resolveDispatcher().useTransition();
19441944
};
1945-
exports.version = "19.1.0-www-modern-3b009b4c-20250102";
1945+
exports.version = "19.1.0-www-modern-bf883beb-20250103";
19461946
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19471947
"function" ===
19481948
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

‎compiled/facebook-www/React-prod.classic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.1.0-www-classic-3b009b4c-20250102";
633+
exports.version = "19.1.0-www-classic-bf883beb-20250103";

‎compiled/facebook-www/React-prod.modern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.1.0-www-modern-3b009b4c-20250102";
633+
exports.version = "19.1.0-www-modern-bf883beb-20250103";

‎compiled/facebook-www/React-profiling.classic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.1.0-www-classic-3b009b4c-20250102";
637+
exports.version = "19.1.0-www-classic-bf883beb-20250103";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

‎compiled/facebook-www/React-profiling.modern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.1.0-www-modern-3b009b4c-20250102";
637+
exports.version = "19.1.0-www-modern-bf883beb-20250103";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

‎compiled/facebook-www/ReactART-dev.classic.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16914,10 +16914,10 @@ __DEV__ &&
1691416914
(function () {
1691516915
var internals = {
1691616916
bundleType: 1,
16917-
version: "19.1.0-www-classic-3b009b4c-20250102",
16917+
version: "19.1.0-www-classic-bf883beb-20250103",
1691816918
rendererPackageName: "react-art",
1691916919
currentDispatcherRef: ReactSharedInternals,
16920-
reconcilerVersion: "19.1.0-www-classic-3b009b4c-20250102"
16920+
reconcilerVersion: "19.1.0-www-classic-bf883beb-20250103"
1692116921
};
1692216922
internals.overrideHookState = overrideHookState;
1692316923
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16951,7 +16951,7 @@ __DEV__ &&
1695116951
exports.Shape = Shape;
1695216952
exports.Surface = Surface;
1695316953
exports.Text = Text;
16954-
exports.version = "19.1.0-www-classic-3b009b4c-20250102";
16954+
exports.version = "19.1.0-www-classic-bf883beb-20250103";
1695516955
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1695616956
"function" ===
1695716957
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

‎compiled/facebook-www/ReactART-dev.modern.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16677,10 +16677,10 @@ __DEV__ &&
1667716677
(function () {
1667816678
var internals = {
1667916679
bundleType: 1,
16680-
version: "19.1.0-www-modern-3b009b4c-20250102",
16680+
version: "19.1.0-www-modern-bf883beb-20250103",
1668116681
rendererPackageName: "react-art",
1668216682
currentDispatcherRef: ReactSharedInternals,
16683-
reconcilerVersion: "19.1.0-www-modern-3b009b4c-20250102"
16683+
reconcilerVersion: "19.1.0-www-modern-bf883beb-20250103"
1668416684
};
1668516685
internals.overrideHookState = overrideHookState;
1668616686
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16714,7 +16714,7 @@ __DEV__ &&
1671416714
exports.Shape = Shape;
1671516715
exports.Surface = Surface;
1671616716
exports.Text = Text;
16717-
exports.version = "19.1.0-www-modern-3b009b4c-20250102";
16717+
exports.version = "19.1.0-www-modern-bf883beb-20250103";
1671816718
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1671916719
"function" ===
1672016720
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

‎compiled/facebook-www/ReactART-prod.classic.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10813,10 +10813,10 @@ var slice = Array.prototype.slice,
1081310813
})(React.Component);
1081410814
var internals$jscomp$inline_1510 = {
1081510815
bundleType: 0,
10816-
version: "19.1.0-www-classic-3b009b4c-20250102",
10816+
version: "19.1.0-www-classic-bf883beb-20250103",
1081710817
rendererPackageName: "react-art",
1081810818
currentDispatcherRef: ReactSharedInternals,
10819-
reconcilerVersion: "19.1.0-www-classic-3b009b4c-20250102"
10819+
reconcilerVersion: "19.1.0-www-classic-bf883beb-20250103"
1082010820
};
1082110821
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1082210822
var hook$jscomp$inline_1511 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10842,4 +10842,4 @@ exports.RadialGradient = RadialGradient;
1084210842
exports.Shape = TYPES.SHAPE;
1084310843
exports.Surface = Surface;
1084410844
exports.Text = Text;
10845-
exports.version = "19.1.0-www-classic-3b009b4c-20250102";
10845+
exports.version = "19.1.0-www-classic-bf883beb-20250103";

‎compiled/facebook-www/ReactART-prod.modern.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10529,10 +10529,10 @@ var slice = Array.prototype.slice,
1052910529
})(React.Component);
1053010530
var internals$jscomp$inline_1489 = {
1053110531
bundleType: 0,
10532-
version: "19.1.0-www-modern-3b009b4c-20250102",
10532+
version: "19.1.0-www-modern-bf883beb-20250103",
1053310533
rendererPackageName: "react-art",
1053410534
currentDispatcherRef: ReactSharedInternals,
10535-
reconcilerVersion: "19.1.0-www-modern-3b009b4c-20250102"
10535+
reconcilerVersion: "19.1.0-www-modern-bf883beb-20250103"
1053610536
};
1053710537
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1053810538
var hook$jscomp$inline_1490 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10558,4 +10558,4 @@ exports.RadialGradient = RadialGradient;
1055810558
exports.Shape = TYPES.SHAPE;
1055910559
exports.Surface = Surface;
1056010560
exports.Text = Text;
10561-
exports.version = "19.1.0-www-modern-3b009b4c-20250102";
10561+
exports.version = "19.1.0-www-modern-bf883beb-20250103";

‎compiled/facebook-www/ReactDOM-dev.classic.js

+39-37
Original file line numberDiff line numberDiff line change
@@ -13956,7 +13956,9 @@ __DEV__ &&
1395613956
if (
1395713957
((hoistableRoot = maybeNodes[i]),
1395813958
hoistableRoot.getAttribute("href") ===
13959-
(null == current.href ? null : current.href) &&
13959+
(null == current.href || "" === current.href
13960+
? null
13961+
: current.href) &&
1396013962
hoistableRoot.getAttribute("rel") ===
1396113963
(null == current.rel ? null : current.rel) &&
1396213964
hoistableRoot.getAttribute("title") ===
@@ -21219,36 +21221,34 @@ __DEV__ &&
2121921221
}
2122021222
case "src":
2122121223
case "href":
21222-
"" !== propKey ||
21223-
("a" === tag && "href" === value) ||
21224-
("object" === tag && "data" === value)
21225-
? hydrateSanitizedAttribute(
21226-
domElement,
21227-
value,
21228-
value,
21229-
propKey,
21230-
extraAttributes,
21231-
serverDifferences
21232-
)
21233-
: ("src" === value
21234-
? error$jscomp$0(
21235-
'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.',
21236-
value,
21237-
value
21238-
)
21239-
: error$jscomp$0(
21240-
'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.',
21241-
value,
21242-
value
21243-
),
21244-
hydrateSanitizedAttribute(
21245-
domElement,
21246-
value,
21247-
value,
21248-
null,
21249-
extraAttributes,
21250-
serverDifferences
21251-
));
21224+
if (
21225+
!(
21226+
"" !== propKey ||
21227+
("a" === tag && "href" === value) ||
21228+
("object" === tag && "data" === value)
21229+
)
21230+
) {
21231+
"src" === value
21232+
? error$jscomp$0(
21233+
'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.',
21234+
value,
21235+
value
21236+
)
21237+
: error$jscomp$0(
21238+
'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.',
21239+
value,
21240+
value
21241+
);
21242+
continue;
21243+
}
21244+
hydrateSanitizedAttribute(
21245+
domElement,
21246+
value,
21247+
value,
21248+
propKey,
21249+
extraAttributes,
21250+
serverDifferences
21251+
);
2125221252
continue;
2125321253
case "action":
2125421254
case "formAction":
@@ -21875,7 +21875,9 @@ __DEV__ &&
2187521875
else if (
2187621876
name !== anyProps.rel ||
2187721877
instance.getAttribute("href") !==
21878-
(null == anyProps.href ? null : anyProps.href) ||
21878+
(null == anyProps.href || "" === anyProps.href
21879+
? null
21880+
: anyProps.href) ||
2187921881
instance.getAttribute("crossorigin") !==
2188021882
(null == anyProps.crossOrigin
2188121883
? null
@@ -27401,11 +27403,11 @@ __DEV__ &&
2740127403
return_targetInst = null;
2740227404
(function () {
2740327405
var isomorphicReactPackageVersion = React.version;
27404-
if ("19.1.0-www-classic-3b009b4c-20250102" !== isomorphicReactPackageVersion)
27406+
if ("19.1.0-www-classic-bf883beb-20250103" !== isomorphicReactPackageVersion)
2740527407
throw Error(
2740627408
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2740727409
(isomorphicReactPackageVersion +
27408-
"\n - react-dom: 19.1.0-www-classic-3b009b4c-20250102\nLearn more: https://react.dev/warnings/version-mismatch")
27410+
"\n - react-dom: 19.1.0-www-classic-bf883beb-20250103\nLearn more: https://react.dev/warnings/version-mismatch")
2740927411
);
2741027412
})();
2741127413
("function" === typeof Map &&
@@ -27448,10 +27450,10 @@ __DEV__ &&
2744827450
!(function () {
2744927451
var internals = {
2745027452
bundleType: 1,
27451-
version: "19.1.0-www-classic-3b009b4c-20250102",
27453+
version: "19.1.0-www-classic-bf883beb-20250103",
2745227454
rendererPackageName: "react-dom",
2745327455
currentDispatcherRef: ReactSharedInternals,
27454-
reconcilerVersion: "19.1.0-www-classic-3b009b4c-20250102"
27456+
reconcilerVersion: "19.1.0-www-classic-bf883beb-20250103"
2745527457
};
2745627458
internals.overrideHookState = overrideHookState;
2745727459
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -28049,7 +28051,7 @@ __DEV__ &&
2804928051
exports.useFormStatus = function () {
2805028052
return resolveDispatcher().useHostTransitionStatus();
2805128053
};
28052-
exports.version = "19.1.0-www-classic-3b009b4c-20250102";
28054+
exports.version = "19.1.0-www-classic-bf883beb-20250103";
2805328055
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2805428056
"function" ===
2805528057
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

‎compiled/facebook-www/ReactDOM-dev.modern.js

+39-37
Original file line numberDiff line numberDiff line change
@@ -13755,7 +13755,9 @@ __DEV__ &&
1375513755
if (
1375613756
((hoistableRoot = maybeNodes[i]),
1375713757
hoistableRoot.getAttribute("href") ===
13758-
(null == current.href ? null : current.href) &&
13758+
(null == current.href || "" === current.href
13759+
? null
13760+
: current.href) &&
1375913761
hoistableRoot.getAttribute("rel") ===
1376013762
(null == current.rel ? null : current.rel) &&
1376113763
hoistableRoot.getAttribute("title") ===
@@ -21006,36 +21008,34 @@ __DEV__ &&
2100621008
}
2100721009
case "src":
2100821010
case "href":
21009-
"" !== propKey ||
21010-
("a" === tag && "href" === value) ||
21011-
("object" === tag && "data" === value)
21012-
? hydrateSanitizedAttribute(
21013-
domElement,
21014-
value,
21015-
value,
21016-
propKey,
21017-
extraAttributes,
21018-
serverDifferences
21019-
)
21020-
: ("src" === value
21021-
? error$jscomp$0(
21022-
'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.',
21023-
value,
21024-
value
21025-
)
21026-
: error$jscomp$0(
21027-
'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.',
21028-
value,
21029-
value
21030-
),
21031-
hydrateSanitizedAttribute(
21032-
domElement,
21033-
value,
21034-
value,
21035-
null,
21036-
extraAttributes,
21037-
serverDifferences
21038-
));
21011+
if (
21012+
!(
21013+
"" !== propKey ||
21014+
("a" === tag && "href" === value) ||
21015+
("object" === tag && "data" === value)
21016+
)
21017+
) {
21018+
"src" === value
21019+
? error$jscomp$0(
21020+
'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.',
21021+
value,
21022+
value
21023+
)
21024+
: error$jscomp$0(
21025+
'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.',
21026+
value,
21027+
value
21028+
);
21029+
continue;
21030+
}
21031+
hydrateSanitizedAttribute(
21032+
domElement,
21033+
value,
21034+
value,
21035+
propKey,
21036+
extraAttributes,
21037+
serverDifferences
21038+
);
2103921039
continue;
2104021040
case "action":
2104121041
case "formAction":
@@ -21662,7 +21662,9 @@ __DEV__ &&
2166221662
else if (
2166321663
name !== anyProps.rel ||
2166421664
instance.getAttribute("href") !==
21665-
(null == anyProps.href ? null : anyProps.href) ||
21665+
(null == anyProps.href || "" === anyProps.href
21666+
? null
21667+
: anyProps.href) ||
2166621668
instance.getAttribute("crossorigin") !==
2166721669
(null == anyProps.crossOrigin
2166821670
? null
@@ -27180,11 +27182,11 @@ __DEV__ &&
2718027182
return_targetInst = null;
2718127183
(function () {
2718227184
var isomorphicReactPackageVersion = React.version;
27183-
if ("19.1.0-www-modern-3b009b4c-20250102" !== isomorphicReactPackageVersion)
27185+
if ("19.1.0-www-modern-bf883beb-20250103" !== isomorphicReactPackageVersion)
2718427186
throw Error(
2718527187
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2718627188
(isomorphicReactPackageVersion +
27187-
"\n - react-dom: 19.1.0-www-modern-3b009b4c-20250102\nLearn more: https://react.dev/warnings/version-mismatch")
27189+
"\n - react-dom: 19.1.0-www-modern-bf883beb-20250103\nLearn more: https://react.dev/warnings/version-mismatch")
2718827190
);
2718927191
})();
2719027192
("function" === typeof Map &&
@@ -27227,10 +27229,10 @@ __DEV__ &&
2722727229
!(function () {
2722827230
var internals = {
2722927231
bundleType: 1,
27230-
version: "19.1.0-www-modern-3b009b4c-20250102",
27232+
version: "19.1.0-www-modern-bf883beb-20250103",
2723127233
rendererPackageName: "react-dom",
2723227234
currentDispatcherRef: ReactSharedInternals,
27233-
reconcilerVersion: "19.1.0-www-modern-3b009b4c-20250102"
27235+
reconcilerVersion: "19.1.0-www-modern-bf883beb-20250103"
2723427236
};
2723527237
internals.overrideHookState = overrideHookState;
2723627238
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -27828,7 +27830,7 @@ __DEV__ &&
2782827830
exports.useFormStatus = function () {
2782927831
return resolveDispatcher().useHostTransitionStatus();
2783027832
};
27831-
exports.version = "19.1.0-www-modern-3b009b4c-20250102";
27833+
exports.version = "19.1.0-www-modern-bf883beb-20250103";
2783227834
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2783327835
"function" ===
2783427836
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)
Please sign in to comment.