Skip to content

Commit 43a609b

Browse files
committed
[Float][Fizz][Fiber] support imagesrcset and imagesizes for ReactDOM.preload() (#26940)
For float methods the href argument is usually all we need to uniquely key the request. However when preloading responsive images it is possible that you may need more than one preload for differing imagesizes attributes. When using imagesrcset for preloads the href attribute acts more like a fallback href. For keying purposes the imagesrcset becomes the primary key conceptually. This change updates the keying logic for `ReactDOM.preload()` when you pass `{as: "image"}` 1. If `options.imageSrcSet` is a non-emtpy string the key is defined as `options.imageSrcSet + options.imageSizes`. The `href` argument is still required but does not participate in keying. 2. If `options.imageSrcSet` is empty, missing, or an invalid format the key is defined as the `href`. Changing the `options.imageSizes` does not affect the key as this option is inert when not using `options.imageSrcSet` Additionally, currently there is a bug in webkit (Safari) that causes preload links to fail to use imageSrcSet and fallback to href even when the browser will correctly resolve srcset on an `<img>` tag. Because the drawbacks of preloading the wrong image (href over imagesrcset) in a modern browser outweight the drawbacks of not preloading anything for responsive images in browsers that do not support srcset at all we will omit the `href` attribute whenever `options.imageSrcSet` is provided. We still require you provide an href since we want to be able to revert this behavior once all major browsers support it bug link: https://bugs.webkit.org/show_bug.cgi?id=231150 DiffTrain build for commit fc929cf.
1 parent 6968ebc commit 43a609b

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23922,7 +23922,7 @@ function createFiberRoot(
2392223922
return root;
2392323923
}
2392423924

23925-
var ReactVersion = "18.3.0-canary-86acc10f2-20230615";
23925+
var ReactVersion = "18.3.0-canary-fc929cf4e-20230615";
2392623926

2392723927
// Might add PROFILE later.
2392823928

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8617,7 +8617,7 @@ var devToolsConfig$jscomp$inline_1031 = {
86178617
throw Error("TestRenderer does not support findFiberByHostInstance()");
86188618
},
86198619
bundleType: 0,
8620-
version: "18.3.0-canary-86acc10f2-20230615",
8620+
version: "18.3.0-canary-fc929cf4e-20230615",
86218621
rendererPackageName: "react-test-renderer"
86228622
};
86238623
var internals$jscomp$inline_1230 = {
@@ -8648,7 +8648,7 @@ var internals$jscomp$inline_1230 = {
86488648
scheduleRoot: null,
86498649
setRefreshHandler: null,
86508650
getCurrentFiber: null,
8651-
reconcilerVersion: "18.3.0-canary-86acc10f2-20230615"
8651+
reconcilerVersion: "18.3.0-canary-fc929cf4e-20230615"
86528652
};
86538653
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
86548654
var hook$jscomp$inline_1231 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9043,7 +9043,7 @@ var devToolsConfig$jscomp$inline_1073 = {
90439043
throw Error("TestRenderer does not support findFiberByHostInstance()");
90449044
},
90459045
bundleType: 0,
9046-
version: "18.3.0-canary-86acc10f2-20230615",
9046+
version: "18.3.0-canary-fc929cf4e-20230615",
90479047
rendererPackageName: "react-test-renderer"
90489048
};
90499049
var internals$jscomp$inline_1271 = {
@@ -9074,7 +9074,7 @@ var internals$jscomp$inline_1271 = {
90749074
scheduleRoot: null,
90759075
setRefreshHandler: null,
90769076
getCurrentFiber: null,
9077-
reconcilerVersion: "18.3.0-canary-86acc10f2-20230615"
9077+
reconcilerVersion: "18.3.0-canary-fc929cf4e-20230615"
90789078
};
90799079
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
90809080
var hook$jscomp$inline_1272 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-canary-86acc10f2-20230615";
30+
var ReactVersion = "18.3.0-canary-fc929cf4e-20230615";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,4 +642,4 @@ exports.useSyncExternalStore = function (
642642
);
643643
};
644644
exports.useTransition = useTransition;
645-
exports.version = "18.3.0-canary-86acc10f2-20230615";
645+
exports.version = "18.3.0-canary-fc929cf4e-20230615";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ exports.useSyncExternalStore = function (
645645
);
646646
};
647647
exports.useTransition = useTransition;
648-
exports.version = "18.3.0-canary-86acc10f2-20230615";
648+
exports.version = "18.3.0-canary-fc929cf4e-20230615";
649649

650650
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
651651
if (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
86acc10f2596e1a6fe2fd57a5b325de85175800b
1+
fc929cf4ead35f99c4e9612a95e8a0bb8f5df25d

0 commit comments

Comments
 (0)