Skip to content

Commit 68d592a

Browse files
committed
get rid of styleQueue.render
1 parent aaebd2f commit 68d592a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ export type ResumableState = {
309309
},
310310
};
311311

312+
let currentlyFlushingRenderState: RenderState | null = null;
313+
312314
const dataElementQuotedEnd = stringToPrecomputedChunk('"></template>');
313315

314316
const startInlineScript = stringToPrecomputedChunk('<script');
@@ -2917,7 +2919,6 @@ function pushLink(
29172919
// to create a StyleQueue
29182920
if (!styleQueue) {
29192921
styleQueue = {
2920-
start: renderState.startInlineStyle,
29212922
precedence: stringToChunk(escapeTextForBrowser(precedence)),
29222923
rules: ([]: Array<Chunk | PrecomputedChunk>),
29232924
hrefs: ([]: Array<Chunk | PrecomputedChunk>),
@@ -3126,7 +3127,6 @@ function pushStyle(
31263127
// This is the first time we've encountered this precedence we need
31273128
// to create a StyleQueue.
31283129
styleQueue = {
3129-
start: renderState.startInlineStyle,
31303130
precedence: stringToChunk(escapeTextForBrowser(precedence)),
31313131
rules: ([]: Array<Chunk | PrecomputedChunk>),
31323132
hrefs: ([]: Array<Chunk | PrecomputedChunk>),
@@ -5232,7 +5232,7 @@ function flushStyleTagsLateForBoundary(
52325232
}
52335233
let i = 0;
52345234
if (hrefs.length) {
5235-
writeChunk(this, styleQueue.start);
5235+
writeChunk(this, ((currentlyFlushingRenderState: any): RenderState).startInlineStyle);
52365236
writeChunk(this, lateStyleTagResourceOpen1);
52375237
writeChunk(this, styleQueue.precedence);
52385238
writeChunk(this, lateStyleTagResourceOpen2);
@@ -5282,7 +5282,9 @@ export function writeHoistablesForBoundary(
52825282
destinationHasCapacity = true;
52835283

52845284
// Flush style tags for each precedence this boundary depends on
5285+
currentlyFlushingRenderState = renderState;
52855286
hoistableState.styles.forEach(flushStyleTagsLateForBoundary, destination);
5287+
currentlyFlushingRenderState = null;
52865288

52875289
// Determine if this boundary has stylesheets that need to be awaited upon completion
52885290
hoistableState.stylesheets.forEach(hasStylesToHoist);
@@ -5347,7 +5349,7 @@ function flushStylesInPreamble(
53475349
// order so even if there are no rules for style tags at this precedence we emit an empty style
53485350
// tag with the data-precedence attribute
53495351
if (!hasStylesheets || hrefs.length) {
5350-
writeChunk(this, styleQueue.start);
5352+
writeChunk(this, ((currentlyFlushingRenderState: any): RenderState).startInlineStyle);
53515353
writeChunk(this, styleTagResourceOpen1);
53525354
writeChunk(this, styleQueue.precedence);
53535355
let i = 0;
@@ -5522,7 +5524,9 @@ export function writePreambleStart(
55225524
renderState.highImagePreloads.clear();
55235525

55245526
// Flush unblocked stylesheets by precedence
5527+
currentlyFlushingRenderState = renderState;
55255528
renderState.styles.forEach(flushStylesInPreamble, destination);
5529+
currentlyFlushingRenderState = null;
55265530

55275531
const importMapChunks = renderState.importMapChunks;
55285532
for (i = 0; i < importMapChunks.length; i++) {
@@ -6113,7 +6117,6 @@ export type HoistableState = {
61136117
};
61146118

61156119
export type StyleQueue = {
6116-
start: PrecomputedChunk,
61176120
precedence: Chunk | PrecomputedChunk,
61186121
rules: Array<Chunk | PrecomputedChunk>,
61196122
hrefs: Array<Chunk | PrecomputedChunk>,
@@ -6565,7 +6568,6 @@ function preinitStyle(
65656568
// to create a StyleQueue
65666569
if (!styleQueue) {
65676570
styleQueue = {
6568-
start: renderState.startInlineStyle,
65696571
precedence: stringToChunk(escapeTextForBrowser(precedence)),
65706572
rules: ([]: Array<Chunk | PrecomputedChunk>),
65716573
hrefs: ([]: Array<Chunk | PrecomputedChunk>),

0 commit comments

Comments
 (0)