From 1a27b0c21fec81c21e695e562482981ab7b65b74 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Tue, 4 Jun 2024 17:57:11 -0400 Subject: [PATCH] Encode fragments properly in DEV Normally we take the renderClientElement path but this is an internal fast path. --- packages/react-server/src/ReactFlightServer.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js index 63c7871cfa20b..87c21dffeba2b 100644 --- a/packages/react-server/src/ReactFlightServer.js +++ b/packages/react-server/src/ReactFlightServer.js @@ -1215,12 +1215,11 @@ function renderFragment( if (task.keyPath !== null) { // We have a Server Component that specifies a key but we're now splitting // the tree using a fragment. - const fragment = [ - REACT_ELEMENT_TYPE, - REACT_FRAGMENT_TYPE, - task.keyPath, - {children}, - ]; + const fragment = __DEV__ + ? enableOwnerStacks + ? [REACT_ELEMENT_TYPE, REACT_FRAGMENT_TYPE, task.keyPath, {children}, null, null, 0] + : [REACT_ELEMENT_TYPE, REACT_FRAGMENT_TYPE, task.keyPath, {children}, null] + : [REACT_ELEMENT_TYPE, REACT_FRAGMENT_TYPE, task.keyPath, {children}]; if (!task.implicitSlot) { // If this was keyed inside a set. I.e. the outer Server Component was keyed // then we need to handle reorders of the whole set. To do this we need to wrap