diff --git a/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js b/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js index efb3b7dbafd7f..eb5366a954f52 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js +++ b/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js @@ -2556,13 +2556,11 @@ const styleInsertionFunction = stringToPrecomputedChunk( ); const completeBoundaryScript1 = stringToPrecomputedChunk('$RC("'); -const completeBoundaryWithStylesScript1 = stringToPrecomputedChunk( - '$RR(false,"', -); +const completeBoundaryWithStylesScript1 = stringToPrecomputedChunk('$RR($RC,"'); const completeContainerScript1 = stringToPrecomputedChunk('$RK("'); const completeContainerWithStylesScript1 = stringToPrecomputedChunk( - '$RR(true,"', + '$RR($RK,"', ); const completeBoundaryOrContainerScript2 = stringToPrecomputedChunk('","'); const completeBoundaryOrContainerScript2a = stringToPrecomputedChunk('",'); diff --git a/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineCodeStrings.js b/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineCodeStrings.js index f8f739b65638d..326a89e3d5bb6 100644 --- a/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineCodeStrings.js +++ b/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineCodeStrings.js @@ -6,7 +6,7 @@ export const clientRenderBoundary = export const completeBoundary = '$RC=function(b,c,e){c=document.getElementById(c);c.parentNode.removeChild(c);var a=document.getElementById(b);if(a){b=a.previousSibling;if(e)b.data="$!",a.setAttribute("data-dgst",e);else{e=b.parentNode;a=b.nextSibling;var f=0;do{if(a&&8===a.nodeType){var d=a.data;if("/$"===d)if(0===f)break;else f--;else"$"!==d&&"$?"!==d&&"$!"!==d||f++}d=a.nextSibling;e.removeChild(a);a=d}while(a);for(;c.firstChild;)e.insertBefore(c.firstChild,a);b.data="$"}b._reactRetry&&b._reactRetry()}};'; export const completeBoundaryWithStyles = - '$RM=new Map;\n$RR=function(g,q,r,v){function t(m){this.s=m}g=window[g?"$RK":"$RC"];for(var u=$RM,n=new Map,p=document,h,e,f=p.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;e=f[d++];)n.set(e.dataset.precedence,h=e);e=0;f=[];for(var c,k,b,a;c=v[e++];){var l=0;k=c[l++];if(b=u.get(k))"l"!==b.s&&f.push(b);else{a=p.createElement("link");a.href=k;a.rel="stylesheet";for(a.dataset.precedence=d=c[l++];b=c[l++];)a.setAttribute(b,c[l++]);b=a._r=new Promise(function(m,w){a.onload=m;a.onerror=\nw});b.then(t.bind(b,"l"),t.bind(b,"e"));u.set(k,b);f.push(b);c=n.get(d)||h;c===h&&(h=a);n.set(d,a);c?c.parentNode.insertBefore(a,c.nextSibling):(d=p.head,d.insertBefore(a,d.firstChild))}}Promise.all(f).then(g.bind(null,q,r,""),g.bind(null,q,r,"Stylesheet failed to load"))};'; + '$RM=new Map;\n$RR=function(p,q,r,v){function t(l){this.s=l}for(var u=$RM,m=new Map,n=document,g,e,f=n.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;e=f[d++];)m.set(e.dataset.precedence,g=e);e=0;f=[];for(var c,h,b,a;c=v[e++];){var k=0;h=c[k++];if(b=u.get(h))"l"!==b.s&&f.push(b);else{a=n.createElement("link");a.href=h;a.rel="stylesheet";for(a.dataset.precedence=d=c[k++];b=c[k++];)a.setAttribute(b,c[k++]);b=a._r=new Promise(function(l,w){a.onload=l;a.onerror=w});b.then(t.bind(b,\n"l"),t.bind(b,"e"));u.set(h,b);f.push(b);c=m.get(d)||g;c===g&&(g=a);m.set(d,a);c?c.parentNode.insertBefore(a,c.nextSibling):(d=n.head,d.insertBefore(a,d.firstChild))}}Promise.all(f).then(p.bind(null,q,r,""),p.bind(null,q,r,"Stylesheet failed to load."))};'; export const completeSegment = '$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};'; export const completeContainer = diff --git a/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineSource.js b/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineSource.js index 38405707d57a2..7c72c262ed08e 100644 --- a/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineSource.js +++ b/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineSource.js @@ -18,12 +18,11 @@ export {clientRenderBoundary, completeBoundary, completeSegment}; // runtime (ReactDOMFizzInstructionSetExternalRuntime), with the exception of // how we read completeBoundaryImpl and resourceMap export function completeBoundaryWithStyles( - isContainer, + completionFn, suspenseBoundaryID, contentID, styles, ) { - const completeBoundaryImpl = window[isContainer ? '$RK' : '$RC']; const resourceMap = window['$RM']; const precedences = new Map(); @@ -106,12 +105,12 @@ export function completeBoundaryWithStyles( } Promise.all(dependencies).then( - completeBoundaryImpl.bind(null, suspenseBoundaryID, contentID, ''), - completeBoundaryImpl.bind( + completionFn.bind(null, suspenseBoundaryID, contentID, ''), + completionFn.bind( null, suspenseBoundaryID, contentID, - 'Stylesheet failed to load', + 'Stylesheet failed to load.', ), ); }