diff --git a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js index 91baeef4a1bff..f8989c18a4a8a 100644 --- a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js +++ b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js @@ -2762,7 +2762,7 @@ function pushImg( props: Object, resumableState: ResumableState, renderState: RenderState, - pictureTagInScope: boolean, + pictureOrNoScriptTagInScope: boolean, ): null { const {src, srcSet} = props; if ( @@ -2771,7 +2771,7 @@ function pushImg( (typeof src === 'string' || src == null) && (typeof srcSet === 'string' || srcSet == null) && props.fetchPriority !== 'low' && - pictureTagInScope === false && + pictureOrNoScriptTagInScope === false && // We exclude data URIs in src and srcSet since these should not be preloaded !( typeof src === 'string' && @@ -3599,7 +3599,7 @@ export function pushStartInstance( props, resumableState, renderState, - !!(formatContext.tagScope & PICTURE_SCOPE), + !!(formatContext.tagScope & (PICTURE_SCOPE | NOSCRIPT_SCOPE)), ); } // Omitted close tags diff --git a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js index c71af838e65dd..3eabcb5781c29 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js @@ -4261,6 +4261,38 @@ body { ); }); + // Fixes: https://github.com/facebook/react/issues/27910 + it('omits preloads for images inside noscript tags', async () => { + function App() { + return ( + +
+ + + + + ); + } + + await act(() => { + renderToPipeableStream(