@samitouri / QOS-React-2 / commits / ea17cc18f4

[Fizz][Float] emit viewport meta before preloads (#27201)

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

Josh Story committed Aug 7, 2023 at 15:22 UTC ea17cc18f458010c89c1bf494be08bb782d034af
1 file changed +3
packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
+3
@@ -1920,6 +1920,9 @@ function pushMeta(
1920
1921 if (typeof props.charSet === 'string') {
1922 return pushSelfClosing(responseState.charsetChunks, props, 'meta');
1923 + } else if (props.name === 'viewport') {
1924 + // "viewport" isn't related to preconnect but it has the right priority
1925 + return pushSelfClosing(responseState.preconnectChunks, props, 'meta');
1926 } else {
1927 return pushSelfClosing(responseState.hoistableChunks, props, 'meta');
1928 }