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 dab6e42 commit 6c9271d
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 @@ -737,6 +737,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 @@ -798,6 +800,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 @@ -851,6 +854,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 6c9271d

Please sign in to comment.