Skip to content

Commit

Permalink
[Fizz][Float] emit viewport meta before preloads (#27201)
Browse files Browse the repository at this point in the history
Fixes: #27200

preloads for images that appear before the viewport meta may be loaded
twice because the proper device image information is not used with the
preload but is with the image itself. The viewport meta should be
emitted earlier than all preloads to avoid this.

this change moves the queue for the viewport meta to preconnects which
already has the right priority for this tag

DiffTrain build for [ea17cc1](ea17cc1)
  • Loading branch information
gnoff committed Aug 7, 2023
1 parent c61c196 commit 9094b9c
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
587ae49d71f218d34393291933d513d2975e22c3
ea17cc18f458010c89c1bf494be08bb782d034af
5 changes: 4 additions & 1 deletion compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-classic-ee8ed08d";
var ReactVersion = "18.3.0-www-classic-8651ccc3";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -4015,6 +4015,9 @@ function pushMeta(

if (typeof props.charSet === "string") {
return pushSelfClosing(responseState.charsetChunks, props, "meta");
} else if (props.name === "viewport") {
// "viewport" isn't related to preconnect but it has the right priority
return pushSelfClosing(responseState.preconnectChunks, props, "meta");
} else {
return pushSelfClosing(responseState.hoistableChunks, props, "meta");
}
Expand Down
5 changes: 4 additions & 1 deletion compiled/facebook-www/ReactDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-modern-4ffe83e1";
var ReactVersion = "18.3.0-www-modern-f39e0868";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -4015,6 +4015,9 @@ function pushMeta(

if (typeof props.charSet === "string") {
return pushSelfClosing(responseState.charsetChunks, props, "meta");
} else if (props.name === "viewport") {
// "viewport" isn't related to preconnect but it has the right priority
return pushSelfClosing(responseState.preconnectChunks, props, "meta");
} else {
return pushSelfClosing(responseState.hoistableChunks, props, "meta");
}
Expand Down
4 changes: 3 additions & 1 deletion compiled/facebook-www/ReactDOMServer-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,8 @@ function pushStartInstance(
(target =
"string" === typeof props.charSet
? pushSelfClosing(responseState.charsetChunks, props, "meta")
: "viewport" === props.name
? pushSelfClosing(responseState.preconnectChunks, props, "meta")
: pushSelfClosing(
responseState.hoistableChunks,
props,
Expand Down Expand Up @@ -4012,4 +4014,4 @@ exports.renderToString = function (children, options) {
'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'
);
};
exports.version = "18.3.0-www-classic-4b8ece22";
exports.version = "18.3.0-www-classic-849751e4";
4 changes: 3 additions & 1 deletion compiled/facebook-www/ReactDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,8 @@ function pushStartInstance(
(target =
"string" === typeof props.charSet
? pushSelfClosing(responseState.charsetChunks, props, "meta")
: "viewport" === props.name
? pushSelfClosing(responseState.preconnectChunks, props, "meta")
: pushSelfClosing(
responseState.hoistableChunks,
props,
Expand Down Expand Up @@ -3910,4 +3912,4 @@ exports.renderToString = function (children, options) {
'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'
);
};
exports.version = "18.3.0-www-modern-d39c47bb";
exports.version = "18.3.0-www-modern-a94e9f5e";
3 changes: 3 additions & 0 deletions compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -4022,6 +4022,9 @@ function pushMeta(

if (typeof props.charSet === "string") {
return pushSelfClosing(responseState.charsetChunks, props, "meta");
} else if (props.name === "viewport") {
// "viewport" isn't related to preconnect but it has the right priority
return pushSelfClosing(responseState.preconnectChunks, props, "meta");
} else {
return pushSelfClosing(responseState.hoistableChunks, props, "meta");
}
Expand Down
2 changes: 2 additions & 0 deletions compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,8 @@ function pushStartInstance(
(target =
"string" === typeof props.charSet
? pushSelfClosing(responseState.charsetChunks, props, "meta")
: "viewport" === props.name
? pushSelfClosing(responseState.preconnectChunks, props, "meta")
: pushSelfClosing(
responseState.hoistableChunks,
props,
Expand Down

0 comments on commit 9094b9c

Please sign in to comment.