Skip to content

Commit cd22717

Browse files
authored
[Flight] Also don't cut off type and key (#31209)
1 parent 147374d commit cd22717

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

packages/react-client/src/ReactFlightClient.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1364,10 +1364,8 @@ function parseModelString(
13641364
// happened.
13651365
Object.defineProperty(parentObject, key, {
13661366
get: function () {
1367-
// We intentionally don't throw an error object here because it looks better
1368-
// without the stack in the console which isn't useful anyway.
1369-
// eslint-disable-next-line no-throw-literal
1370-
throw (
1367+
// TODO: We should ideally throw here to indicate a difference.
1368+
return (
13711369
'This object has been omitted by React in the console log ' +
13721370
'to avoid sending too much data from the server. Try logging smaller ' +
13731371
'or more specific objects.'

packages/react-server/src/ReactFlightServer.js

+11
Original file line numberDiff line numberDiff line change
@@ -3465,7 +3465,18 @@ function renderConsoleValue(
34653465
if (element._owner != null) {
34663466
outlineComponentInfo(request, element._owner);
34673467
}
3468+
if (typeof element.type === 'object' && element.type !== null) {
3469+
// If the type is an object it can get cut off which shouldn't happen here.
3470+
doNotLimit.add(element.type);
3471+
}
3472+
if (typeof element.key === 'object' && element.key !== null) {
3473+
// This should never happen but just in case.
3474+
doNotLimit.add(element.key);
3475+
}
34683476
doNotLimit.add(element.props);
3477+
if (element._owner !== null) {
3478+
doNotLimit.add(element._owner);
3479+
}
34693480

34703481
if (enableOwnerStacks) {
34713482
let debugStack: null | ReactStackTrace = null;

0 commit comments

Comments
 (0)