Skip to content

Commit

Permalink
Track keyPath when rendering through a SuspenseBoundary
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Sep 13, 2023
1 parent 2035db8 commit 6c65878
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react-server/src/ReactFizzServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ function renderSuspenseBoundary(
props: Object,
): void {
pushBuiltInComponentStackInDEV(task, 'Suspense');

const prevKeyPath = task.keyPath;
const parentBoundary = task.blockedBoundary;
const parentSegment = task.blockedSegment;

Expand Down Expand Up @@ -799,6 +801,7 @@ function renderSuspenseBoundary(
newBoundary.resources,
);
}
task.keyPath = keyPath;
try {
// We use the safe form because we don't handle suspending here. Only error handling.
renderNode(request, task, content, -1);
Expand Down Expand Up @@ -852,6 +855,7 @@ function renderSuspenseBoundary(
}
task.blockedBoundary = parentBoundary;
task.blockedSegment = parentSegment;
task.keyPath = prevKeyPath;
}

// We create suspended task for the fallback because we don't want to actually work
Expand Down

0 comments on commit 6c65878

Please sign in to comment.