Skip to content

Commit 7acd0ac

Browse files
committed
We can simplify checks that are now done deeper
1 parent 7bbdb7a commit 7acd0ac

File tree

1 file changed

+20
-52
lines changed

1 file changed

+20
-52
lines changed

packages/react-server/src/ReactFizzServer.js

Lines changed: 20 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,11 +1019,7 @@ function replaySuspenseBoundary(
10191019
}
10201020
try {
10211021
// We use the safe form because we don't handle suspending here. Only error handling.
1022-
if (typeof childSlots === 'number') {
1023-
resumeNode(request, task, childSlots, content, -1);
1024-
} else {
1025-
renderNode(request, task, content, -1);
1026-
}
1022+
renderNode(request, task, content, -1);
10271023
if (task.replay.pendingTasks === 1 && task.replay.nodes.length > 0) {
10281024
throw new Error(
10291025
"Couldn't find all resumable slots by key/index during replaying. " +
@@ -1089,53 +1085,25 @@ function replaySuspenseBoundary(
10891085
let suspendedFallbackTask;
10901086
// We create suspended task for the fallback because we don't want to actually work
10911087
// on it yet in case we finish the main content, so we queue for later.
1092-
if (typeof fallbackSlots === 'number') {
1093-
// Resuming directly in the fallback.
1094-
const resumedSegment = createPendingSegment(
1095-
request,
1096-
0,
1097-
null,
1098-
task.formatContext,
1099-
false,
1100-
false,
1101-
);
1102-
resumedSegment.id = fallbackSlots;
1103-
resumedSegment.parentFlushed = true;
1104-
suspendedFallbackTask = createRenderTask(
1105-
request,
1106-
null,
1107-
fallback,
1108-
-1,
1109-
parentBoundary,
1110-
resumedSegment,
1111-
fallbackAbortSet,
1112-
fallbackKeyPath,
1113-
task.formatContext,
1114-
task.legacyContext,
1115-
task.context,
1116-
task.treeContext,
1117-
);
1118-
} else {
1119-
const fallbackReplay = {
1120-
nodes: fallbackNodes,
1121-
slots: fallbackSlots,
1122-
pendingTasks: 0,
1123-
};
1124-
suspendedFallbackTask = createReplayTask(
1125-
request,
1126-
null,
1127-
fallbackReplay,
1128-
fallback,
1129-
-1,
1130-
parentBoundary,
1131-
fallbackAbortSet,
1132-
fallbackKeyPath,
1133-
task.formatContext,
1134-
task.legacyContext,
1135-
task.context,
1136-
task.treeContext,
1137-
);
1138-
}
1088+
const fallbackReplay = {
1089+
nodes: fallbackNodes,
1090+
slots: fallbackSlots,
1091+
pendingTasks: 0,
1092+
};
1093+
suspendedFallbackTask = createReplayTask(
1094+
request,
1095+
null,
1096+
fallbackReplay,
1097+
fallback,
1098+
-1,
1099+
parentBoundary,
1100+
fallbackAbortSet,
1101+
fallbackKeyPath,
1102+
task.formatContext,
1103+
task.legacyContext,
1104+
task.context,
1105+
task.treeContext,
1106+
);
11391107
if (__DEV__) {
11401108
suspendedFallbackTask.componentStack = task.componentStack;
11411109
}

0 commit comments

Comments
 (0)