mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
[Fizz] Simplify createSuspenseBoundary path (#35087)
Small follow up to #35068. Since this is now a single argument we can simplify the creation branching a bit and make sure it's const.
This commit is contained in:
1 parent
6362b5c711
commit
c83be7da9f
1 file changed
+14
-36
+14
-36
@@ -1291,24 +1291,13 @@ function renderSuspenseBoundary(
|
||||
const defer: boolean = enableCPUSuspense && props.defer === true;
|
||||
|
||||
const fallbackAbortSet: Set<Task> = new Set();
|
||||
let newBoundary: SuspenseBoundary;
|
||||
if (canHavePreamble(task.formatContext)) {
|
||||
newBoundary = createSuspenseBoundary(
|
||||
request,
|
||||
task.row,
|
||||
fallbackAbortSet,
|
||||
createPreamble(),
|
||||
defer,
|
||||
);
|
||||
} else {
|
||||
newBoundary = createSuspenseBoundary(
|
||||
request,
|
||||
task.row,
|
||||
fallbackAbortSet,
|
||||
null,
|
||||
defer,
|
||||
);
|
||||
}
|
||||
const newBoundary = createSuspenseBoundary(
|
||||
request,
|
||||
task.row,
|
||||
fallbackAbortSet,
|
||||
canHavePreamble(task.formatContext) ? createPreamble() : null,
|
||||
defer,
|
||||
);
|
||||
|
||||
const insertionIndex = parentSegment.chunks.length;
|
||||
// The children of the boundary segment is actually the fallback.
|
||||
@@ -1603,24 +1592,13 @@ function replaySuspenseBoundary(
|
||||
const defer: boolean = enableCPUSuspense && props.defer === true;
|
||||
|
||||
const fallbackAbortSet: Set<Task> = new Set();
|
||||
let resumedBoundary: SuspenseBoundary;
|
||||
if (canHavePreamble(task.formatContext)) {
|
||||
resumedBoundary = createSuspenseBoundary(
|
||||
request,
|
||||
task.row,
|
||||
fallbackAbortSet,
|
||||
createPreamble(),
|
||||
defer,
|
||||
);
|
||||
} else {
|
||||
resumedBoundary = createSuspenseBoundary(
|
||||
request,
|
||||
task.row,
|
||||
fallbackAbortSet,
|
||||
null,
|
||||
defer,
|
||||
);
|
||||
}
|
||||
const resumedBoundary = createSuspenseBoundary(
|
||||
request,
|
||||
task.row,
|
||||
fallbackAbortSet,
|
||||
canHavePreamble(task.formatContext) ? createPreamble() : null,
|
||||
defer,
|
||||
);
|
||||
resumedBoundary.parentFlushed = true;
|
||||
// We restore the same id of this boundary as was used during prerender.
|
||||
resumedBoundary.rootSegmentID = id;
|
||||
|
||||
Reference in new issue
Block a user