[Flight] Also don't cut off type and key (#31209)

This commit is contained in:
Sebastian Markbåge
2024-10-13 12:57:50 -04:00
committed by GitHub
parent 147374d71a
commit cd22717c27
2 changed files with 13 additions and 4 deletions

View File

@@ -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.'

View File

@@ -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;