Skip to content

Commit

Permalink
[Fizz][Float] emit viewport meta before preloads (facebook#27201)
Browse files Browse the repository at this point in the history
Fixes: facebook#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
  • Loading branch information
gnoff authored and AndyPengc12 committed Apr 15, 2024
1 parent d8b20a9 commit 26a2891
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,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

0 comments on commit 26a2891

Please sign in to comment.