Skip to content

Commit

Permalink
[Flight] Also don't cut off type and key (#31209)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage authored Oct 13, 2024
1 parent 147374d commit cd22717
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1364,10 +1364,8 @@ function parseModelString(
// happened.
Object.defineProperty(parentObject, key, {
get: function () {
// We intentionally don't throw an error object here because it looks better
// without the stack in the console which isn't useful anyway.
// eslint-disable-next-line no-throw-literal
throw (
// TODO: We should ideally throw here to indicate a difference.
return (
'This object has been omitted by React in the console log ' +
'to avoid sending too much data from the server. Try logging smaller ' +
'or more specific objects.'
Expand Down
11 changes: 11 additions & 0 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3465,7 +3465,18 @@ function renderConsoleValue(
if (element._owner != null) {
outlineComponentInfo(request, element._owner);
}
if (typeof element.type === 'object' && element.type !== null) {
// If the type is an object it can get cut off which shouldn't happen here.
doNotLimit.add(element.type);
}
if (typeof element.key === 'object' && element.key !== null) {
// This should never happen but just in case.
doNotLimit.add(element.key);
}
doNotLimit.add(element.props);
if (element._owner !== null) {
doNotLimit.add(element._owner);
}

if (enableOwnerStacks) {
let debugStack: null | ReactStackTrace = null;
Expand Down

0 comments on commit cd22717

Please sign in to comment.