[Flight] Fix stack getting object limited (#33733)
Because the object limit is unfortunately depth first due to limitations of JSON stringify, we need to ensure that things we really don't want outlined are first in the enumeration order. We add the stack length to the object limit to ensure that the stack frames aren't outlined. In console all the user space arguments are at the end of the args. In server component props, the props are at the end of the properties of the element. For the `value` of I/O we had it before the stack so it could steal the limit from the stack. The fix is to put it at the end.
Sebastian Markbåge committed
Jul 8, 2025 at 12:54 UTC
777264b4ef52797f63d0ed3e9e21b66b7ae6780e
1 file changed
+4
-4
packages/react-server/src/ReactFlightServer.js
+4
-4
@@ -4072,10 +4072,6 @@ function emitIOInfoChunk(
4072
start: relativeStartTimestamp,
4073
end: relativeEndTimestamp,
4074
};
4075
- if (value !== undefined) {
4076
- // $FlowFixMe[cannot-write]
4077
- debugIOInfo.value = value;
4078
- }
4075
if (env != null) {
4076
// $FlowFixMe[cannot-write]
4077
debugIOInfo.env = env;
@@ -4088,6 +4084,10 @@ function emitIOInfoChunk(
4084
// $FlowFixMe[cannot-write]
4085
debugIOInfo.owner = owner;
4086
}
4087
+ if (value !== undefined) {
4088
+ // $FlowFixMe[cannot-write]
4089
+ debugIOInfo.value = value;
4090
+ }
4091
const json: string = serializeDebugModel(request, objectLimit, debugIOInfo);
4092
const row = id.toString(16) + ':J' + json + '\n';
4093
const processedChunk = stringToChunk(row);