Skip to content

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Sep 29, 2025

Could also affect DevTools. Bumped into this with "TypeError: str.startWith is not a function". Stricter types revealed some more potential misses.

@eps1lon eps1lon requested a review from sebmarkbage September 29, 2025 18:34
@meta-cla meta-cla bot added the CLA Signed label Sep 29, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Sep 29, 2025
@eps1lon eps1lon requested a review from unstubbable September 29, 2025 18:35
@react-sizebot
Copy link

Comparing: 319a786...9d47086

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 536.10 kB 536.10 kB = 94.79 kB 94.79 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 663.69 kB 663.69 kB = 117.00 kB 117.00 kB
facebook-www/ReactDOM-prod.classic.js = 687.59 kB 687.59 kB = 121.04 kB 121.04 kB
facebook-www/ReactDOM-prod.modern.js = 678.02 kB 678.02 kB = 119.40 kB 119.40 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 9d47086

Comment on lines 10 to 72
export function getIODescription(value: mixed): string {
if (!__DEV__) {
return '';
}
try {
switch (typeof value) {
case 'object':
// Test the object for a bunch of common property names that are useful identifiers.
// While we only have the return value here, it should ideally be a name that
// describes the arguments requested.
if (value === null) {
return '';
} else if (value instanceof Error) {
// eslint-disable-next-line react-internal/safe-string-coercion
return String(value.message);
} else if (typeof value.url === 'string') {
return value.url;
} else if (typeof value.href === 'string') {
return value.href;
} else if (typeof value.src === 'string') {
return value.src;
} else if (typeof value.currentSrc === 'string') {
return value.currentSrc;
} else if (typeof value.command === 'string') {
return value.command;
} else if (
typeof value.request === 'object' &&
value.request !== null &&
typeof value.request.url === 'string'
) {
return value.request.url;
} else if (
typeof value.response === 'object' &&
value.response !== null &&
typeof value.response.url === 'string'
) {
return value.response.url;
} else if (
typeof value.id === 'string' ||
typeof value.id === 'number' ||
typeof value.id === 'bigint'
) {
// eslint-disable-next-line react-internal/safe-string-coercion
return String(value.id);
} else if (typeof value.name === 'string') {
return value.name;
} else {
const str = value.toString();
if (str.startWith('[object ') || str.length < 5 || str.length > 500) {
if (
str.startsWith('[object ') ||
str.length < 5 ||
str.length > 500
) {
// This is probably not a useful description.
return '';
}
return str;
}
case 'string':
if (value.length < 5 || value.length > 500) {
return '';
}
return value;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This whole thing is inside a try/catch so how could you have gotten a crash? Wouldn't it just be empty string?

Copy link
Collaborator

Choose a reason for hiding this comment

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

(Also the new GitHub UI is very buggy. This is not the line I commented on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't see a crash but me stepping through with pausing on caught exceptions. Didn't see the try-catch higher up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated title and PR desc

@eps1lon eps1lon changed the title [Flight] Fix crash when computing I/O description for exotic types [Flight] Compute better I/O description for exotic types Sep 29, 2025
@eps1lon eps1lon merged commit ecb2ce6 into facebook:main Sep 29, 2025
247 checks passed
@eps1lon eps1lon deleted the sebbie/09-29-_flight_fix_crash_when_computing_i/o_description_for_exotic_types branch September 29, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants