Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround because we read model[0] in two places in our own parsing which triggers this throw.

'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
Loading