Skip to content

Commit 63042a5

Browse files
committed
Don't increase serializedSize for every recursive pass
1 parent 0ca8420 commit 63042a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/react-server/src/ReactFlightServer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,9 @@ function renderModel(
23022302
key: string,
23032303
value: ReactClientValue,
23042304
): ReactJSONValue {
2305+
// First time we're serializing the key, we should add it to the size.
2306+
serializedSize += key.length;
2307+
23052308
const prevKeyPath = task.keyPath;
23062309
const prevImplicitSlot = task.implicitSlot;
23072310
try {
@@ -2416,8 +2419,6 @@ function renderModelDestructive(
24162419
// Set the currently rendering model
24172420
task.model = value;
24182421

2419-
serializedSize += parentPropertyName.length;
2420-
24212422
// Special Symbol, that's very common.
24222423
if (value === REACT_ELEMENT_TYPE) {
24232424
return '$';

0 commit comments

Comments
 (0)