Skip to content

Commit 2c0c9e7

Browse files
committed
[Float][Fizz] Fix srcSet and sizes handling for suspensey img preloads (#27217)
imageSrcSet should have been srcSet when referencing an img tag. imageSizes should have been sizes. This caused preloads for img tags using srcSet and sizes to incorrectly render as having a href only, dropping the srcSet and sizes part of the preload DiffTrain build for [4e3618a](4e3618a)
1 parent fc901a8 commit 2c0c9e7

File tree

7 files changed

+41
-41
lines changed

7 files changed

+41
-41
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f359f9b41ac1a8127f5ba505e0c04675eee0d310
1+
4e3618ae41669c95a3377ae615c727f74f89d141

compiled/facebook-www/ReactDOMServer-dev.classic.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (__DEV__) {
1919
var React = require("react");
2020
var ReactDOM = require("react-dom");
2121

22-
var ReactVersion = "18.3.0-www-classic-328214ad";
22+
var ReactVersion = "18.3.0-www-classic-fa9bab35";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -4526,9 +4526,9 @@ function pushImg(target, props, resources) {
45264526
// We have a suspensey image and ought to preload it to optimize the loading of display blocking
45274527
// resources.
45284528
var src = props.src,
4529-
imageSrcSet = props.imageSrcSet,
4530-
imageSizes = props.imageSizes;
4531-
var key = getImagePreloadKey(src, imageSrcSet, imageSizes);
4529+
srcSet = props.srcSet,
4530+
sizes = props.sizes;
4531+
var key = getImagePreloadKey(src, srcSet, sizes);
45324532
var resource = resources.preloadsMap.get(key);
45334533

45344534
if (!resource) {
@@ -4543,9 +4543,9 @@ function pushImg(target, props, resources) {
45434543
// so we omit the href here if we have imageSrcSet b/c safari will load the wrong image.
45444544
// This harms older browers that do not support imageSrcSet by making their preloads not work
45454545
// but this population is shrinking fast and is already small so we accept this tradeoff.
4546-
href: imageSrcSet ? undefined : src,
4547-
imageSrcSet: imageSrcSet,
4548-
imageSizes: imageSizes,
4546+
href: srcSet ? undefined : src,
4547+
imageSrcSet: srcSet,
4548+
imageSizes: sizes,
45494549
crossOrigin: props.crossOrigin,
45504550
integrity: props.integrity,
45514551
type: props.type,

compiled/facebook-www/ReactDOMServer-dev.modern.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (__DEV__) {
1919
var React = require("react");
2020
var ReactDOM = require("react-dom");
2121

22-
var ReactVersion = "18.3.0-www-modern-22476bdc";
22+
var ReactVersion = "18.3.0-www-modern-5b01b01a";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -4526,9 +4526,9 @@ function pushImg(target, props, resources) {
45264526
// We have a suspensey image and ought to preload it to optimize the loading of display blocking
45274527
// resources.
45284528
var src = props.src,
4529-
imageSrcSet = props.imageSrcSet,
4530-
imageSizes = props.imageSizes;
4531-
var key = getImagePreloadKey(src, imageSrcSet, imageSizes);
4529+
srcSet = props.srcSet,
4530+
sizes = props.sizes;
4531+
var key = getImagePreloadKey(src, srcSet, sizes);
45324532
var resource = resources.preloadsMap.get(key);
45334533

45344534
if (!resource) {
@@ -4543,9 +4543,9 @@ function pushImg(target, props, resources) {
45434543
// so we omit the href here if we have imageSrcSet b/c safari will load the wrong image.
45444544
// This harms older browers that do not support imageSrcSet by making their preloads not work
45454545
// but this population is shrinking fast and is already small so we accept this tradeoff.
4546-
href: imageSrcSet ? undefined : src,
4547-
imageSrcSet: imageSrcSet,
4548-
imageSizes: imageSizes,
4546+
href: srcSet ? undefined : src,
4547+
imageSrcSet: srcSet,
4548+
imageSizes: sizes,
45494549
crossOrigin: props.crossOrigin,
45504550
integrity: props.integrity,
45514551
type: props.type,

compiled/facebook-www/ReactDOMServer-prod.classic.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,9 +1309,9 @@ function pushStartInstance(
13091309
"low" !== props.fetchPriority
13101310
) {
13111311
var src = props.src,
1312-
imageSrcSet = props.imageSrcSet,
1313-
imageSizes = props.imageSizes,
1314-
key$jscomp$1 = getImagePreloadKey(src, imageSrcSet, imageSizes),
1312+
srcSet = props.srcSet,
1313+
sizes = props.sizes,
1314+
key$jscomp$1 = getImagePreloadKey(src, srcSet, sizes),
13151315
resource$jscomp$1 = resources.preloadsMap.get(key$jscomp$1);
13161316
resource$jscomp$1 ||
13171317
((resource$jscomp$1 = {
@@ -1321,9 +1321,9 @@ function pushStartInstance(
13211321
props: {
13221322
rel: "preload",
13231323
as: "image",
1324-
href: imageSrcSet ? void 0 : src,
1325-
imageSrcSet: imageSrcSet,
1326-
imageSizes: imageSizes,
1324+
href: srcSet ? void 0 : src,
1325+
imageSrcSet: srcSet,
1326+
imageSizes: sizes,
13271327
crossOrigin: props.crossOrigin,
13281328
integrity: props.integrity,
13291329
type: props.type,
@@ -4115,4 +4115,4 @@ exports.renderToString = function (children, options) {
41154115
'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'
41164116
);
41174117
};
4118-
exports.version = "18.3.0-www-classic-e3bb40fc";
4118+
exports.version = "18.3.0-www-classic-93cba403";

compiled/facebook-www/ReactDOMServer-prod.modern.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,9 +1308,9 @@ function pushStartInstance(
13081308
"low" !== props.fetchPriority
13091309
) {
13101310
var src = props.src,
1311-
imageSrcSet = props.imageSrcSet,
1312-
imageSizes = props.imageSizes,
1313-
key$jscomp$1 = getImagePreloadKey(src, imageSrcSet, imageSizes),
1311+
srcSet = props.srcSet,
1312+
sizes = props.sizes,
1313+
key$jscomp$1 = getImagePreloadKey(src, srcSet, sizes),
13141314
resource$jscomp$1 = resources.preloadsMap.get(key$jscomp$1);
13151315
resource$jscomp$1 ||
13161316
((resource$jscomp$1 = {
@@ -1320,9 +1320,9 @@ function pushStartInstance(
13201320
props: {
13211321
rel: "preload",
13221322
as: "image",
1323-
href: imageSrcSet ? void 0 : src,
1324-
imageSrcSet: imageSrcSet,
1325-
imageSizes: imageSizes,
1323+
href: srcSet ? void 0 : src,
1324+
imageSrcSet: srcSet,
1325+
imageSizes: sizes,
13261326
crossOrigin: props.crossOrigin,
13271327
integrity: props.integrity,
13281328
type: props.type,
@@ -4013,4 +4013,4 @@ exports.renderToString = function (children, options) {
40134013
'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'
40144014
);
40154015
};
4016-
exports.version = "18.3.0-www-modern-b294751b";
4016+
exports.version = "18.3.0-www-modern-ff434910";

compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4533,9 +4533,9 @@ function pushImg(target, props, resources) {
45334533
// We have a suspensey image and ought to preload it to optimize the loading of display blocking
45344534
// resources.
45354535
var src = props.src,
4536-
imageSrcSet = props.imageSrcSet,
4537-
imageSizes = props.imageSizes;
4538-
var key = getImagePreloadKey(src, imageSrcSet, imageSizes);
4536+
srcSet = props.srcSet,
4537+
sizes = props.sizes;
4538+
var key = getImagePreloadKey(src, srcSet, sizes);
45394539
var resource = resources.preloadsMap.get(key);
45404540

45414541
if (!resource) {
@@ -4550,9 +4550,9 @@ function pushImg(target, props, resources) {
45504550
// so we omit the href here if we have imageSrcSet b/c safari will load the wrong image.
45514551
// This harms older browers that do not support imageSrcSet by making their preloads not work
45524552
// but this population is shrinking fast and is already small so we accept this tradeoff.
4553-
href: imageSrcSet ? undefined : src,
4554-
imageSrcSet: imageSrcSet,
4555-
imageSizes: imageSizes,
4553+
href: srcSet ? undefined : src,
4554+
imageSrcSet: srcSet,
4555+
imageSizes: sizes,
45564556
crossOrigin: props.crossOrigin,
45574557
integrity: props.integrity,
45584558
type: props.type,

compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,9 +1338,9 @@ function pushStartInstance(
13381338
"low" !== props.fetchPriority
13391339
) {
13401340
var src = props.src,
1341-
imageSrcSet = props.imageSrcSet,
1342-
imageSizes = props.imageSizes,
1343-
key$jscomp$1 = getImagePreloadKey(src, imageSrcSet, imageSizes),
1341+
srcSet = props.srcSet,
1342+
sizes = props.sizes,
1343+
key$jscomp$1 = getImagePreloadKey(src, srcSet, sizes),
13441344
resource$jscomp$1 = resources.preloadsMap.get(key$jscomp$1);
13451345
resource$jscomp$1 ||
13461346
((resource$jscomp$1 = {
@@ -1350,9 +1350,9 @@ function pushStartInstance(
13501350
props: {
13511351
rel: "preload",
13521352
as: "image",
1353-
href: imageSrcSet ? void 0 : src,
1354-
imageSrcSet: imageSrcSet,
1355-
imageSizes: imageSizes,
1353+
href: srcSet ? void 0 : src,
1354+
imageSrcSet: srcSet,
1355+
imageSizes: sizes,
13561356
crossOrigin: props.crossOrigin,
13571357
integrity: props.integrity,
13581358
type: props.type,

0 commit comments

Comments
 (0)