Skip to content

Commit

Permalink
Add support for preload media to ReactDOM (#28635)
Browse files Browse the repository at this point in the history
This PR adds support for `media` option to `ReactDOM.preload()`, which
is needed when images differ between screen sizes (for example mobile vs
desktop)

DiffTrain build for [78328c0](78328c0)
  • Loading branch information
gnoff committed Mar 28, 2024
1 parent 66062f0 commit 9d23ab1
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 33 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
05797ccebd285999343ab4fb94eb542f84be23b1
78328c0c4d70c9b9ee4ad2d6a2319c95e628dd2d
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -36349,7 +36349,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "19.0.0-www-classic-b4284fbc";
var ReactVersion = "19.0.0-www-classic-1e457a42";

function createPortal$1(
children,
Expand Down Expand Up @@ -49327,7 +49327,8 @@ if (__DEV__) {
imageSizes:
typeof options.imageSizes === "string"
? options.imageSizes
: undefined
: undefined,
media: typeof options.media === "string" ? options.media : undefined
});
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -36197,7 +36197,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "19.0.0-www-modern-fb26bdde";
var ReactVersion = "19.0.0-www-modern-44db9222";

function createPortal$1(
children,
Expand Down Expand Up @@ -48567,7 +48567,8 @@ if (__DEV__) {
imageSizes:
typeof options.imageSizes === "string"
? options.imageSizes
: undefined
: undefined,
media: typeof options.media === "string" ? options.media : undefined
});
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
Expand Down
9 changes: 5 additions & 4 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17109,7 +17109,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1732 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-classic-b3b87115",
version: "19.0.0-www-classic-49cd2ee2",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2160 = {
Expand Down Expand Up @@ -17139,7 +17139,7 @@ var internals$jscomp$inline_2160 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-b3b87115"
reconcilerVersion: "19.0.0-www-classic-49cd2ee2"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2161 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17480,7 +17480,8 @@ exports.preload = function (href, options) {
imageSrcSet:
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
imageSizes:
"string" === typeof options.imageSizes ? options.imageSizes : void 0
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
media: "string" === typeof options.media ? options.media : void 0
});
}
};
Expand Down Expand Up @@ -17588,4 +17589,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-b3b87115";
exports.version = "19.0.0-www-classic-49cd2ee2";
9 changes: 5 additions & 4 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16620,7 +16620,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1689 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-modern-b17a9802",
version: "19.0.0-www-modern-8192012c",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2116 = {
Expand Down Expand Up @@ -16650,7 +16650,7 @@ var internals$jscomp$inline_2116 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-b17a9802"
reconcilerVersion: "19.0.0-www-modern-8192012c"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2117 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16892,7 +16892,8 @@ exports.preload = function (href, options) {
imageSrcSet:
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
imageSizes:
"string" === typeof options.imageSizes ? options.imageSizes : void 0
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
media: "string" === typeof options.media ? options.media : void 0
});
}
};
Expand Down Expand Up @@ -16952,4 +16953,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-b17a9802";
exports.version = "19.0.0-www-modern-8192012c";
9 changes: 5 additions & 4 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17859,7 +17859,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1818 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-classic-b596d832",
version: "19.0.0-www-classic-837a1523",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand Down Expand Up @@ -17903,7 +17903,7 @@ var devToolsConfig$jscomp$inline_1818 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-b596d832"
reconcilerVersion: "19.0.0-www-classic-837a1523"
});
var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog");
if ("function" !== typeof ReactFiberErrorDialogWWW.showErrorDialog)
Expand Down Expand Up @@ -18231,7 +18231,8 @@ exports.preload = function (href, options) {
imageSrcSet:
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
imageSizes:
"string" === typeof options.imageSizes ? options.imageSizes : void 0
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
media: "string" === typeof options.media ? options.media : void 0
});
}
};
Expand Down Expand Up @@ -18339,7 +18340,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-b596d832";
exports.version = "19.0.0-www-classic-837a1523";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
9 changes: 5 additions & 4 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -17364,7 +17364,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1775 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-modern-e6c62f63",
version: "19.0.0-www-modern-88a914d1",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand Down Expand Up @@ -17408,7 +17408,7 @@ var devToolsConfig$jscomp$inline_1775 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-e6c62f63"
reconcilerVersion: "19.0.0-www-modern-88a914d1"
});
var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog");
if ("function" !== typeof ReactFiberErrorDialogWWW.showErrorDialog)
Expand Down Expand Up @@ -17637,7 +17637,8 @@ exports.preload = function (href, options) {
imageSrcSet:
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
imageSizes:
"string" === typeof options.imageSizes ? options.imageSizes : void 0
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
media: "string" === typeof options.media ? options.media : void 0
});
}
};
Expand Down Expand Up @@ -17697,7 +17698,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-e6c62f63";
exports.version = "19.0.0-www-modern-88a914d1";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactDOMTesting-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -36973,7 +36973,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "19.0.0-www-classic-abb3b76b";
var ReactVersion = "19.0.0-www-classic-8f03a493";

function createPortal$1(
children,
Expand Down Expand Up @@ -50083,7 +50083,8 @@ if (__DEV__) {
imageSizes:
typeof options.imageSizes === "string"
? options.imageSizes
: undefined
: undefined,
media: typeof options.media === "string" ? options.media : undefined
});
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactDOMTesting-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -36821,7 +36821,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "19.0.0-www-modern-6f2ccb79";
var ReactVersion = "19.0.0-www-modern-e638378b";

function createPortal$1(
children,
Expand Down Expand Up @@ -49323,7 +49323,8 @@ if (__DEV__) {
imageSizes:
typeof options.imageSizes === "string"
? options.imageSizes
: undefined
: undefined,
media: typeof options.media === "string" ? options.media : undefined
});
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
Expand Down
9 changes: 5 additions & 4 deletions compiled/facebook-www/ReactDOMTesting-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17438,7 +17438,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1759 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-classic-c22cf513",
version: "19.0.0-www-classic-5470479f",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2168 = {
Expand Down Expand Up @@ -17468,7 +17468,7 @@ var internals$jscomp$inline_2168 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-c22cf513"
reconcilerVersion: "19.0.0-www-classic-5470479f"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2169 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17952,7 +17952,8 @@ exports.preload = function (href, options) {
imageSrcSet:
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
imageSizes:
"string" === typeof options.imageSizes ? options.imageSizes : void 0
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
media: "string" === typeof options.media ? options.media : void 0
});
}
};
Expand Down Expand Up @@ -18060,4 +18061,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-c22cf513";
exports.version = "19.0.0-www-classic-5470479f";
9 changes: 5 additions & 4 deletions compiled/facebook-www/ReactDOMTesting-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -17010,7 +17010,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1716 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-modern-8807c427",
version: "19.0.0-www-modern-943bd092",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2120 = {
Expand Down Expand Up @@ -17040,7 +17040,7 @@ var internals$jscomp$inline_2120 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-8807c427"
reconcilerVersion: "19.0.0-www-modern-943bd092"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2121 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17406,7 +17406,8 @@ exports.preload = function (href, options) {
imageSrcSet:
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
imageSizes:
"string" === typeof options.imageSizes ? options.imageSizes : void 0
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
media: "string" === typeof options.media ? options.media : void 0
});
}
};
Expand Down Expand Up @@ -17465,4 +17466,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-8807c427";
exports.version = "19.0.0-www-modern-943bd092";

0 comments on commit 9d23ab1

Please sign in to comment.