Skip to content

Commit ac7da9d

Browse files
authored
[Flight] Make it more obvious what the short name in the I/O description represents (facebook#33944)
1 parent 0dca9c2 commit ac7da9d

File tree

2 files changed

+387
-277
lines changed

2 files changed

+387
-277
lines changed

packages/react-client/src/ReactFlightPerformanceTrack.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,13 @@ function getIOShortName(
412412
const slashIdx = description.lastIndexOf('/', queryIdx - 1);
413413
if (queryIdx - slashIdx < descMaxLength) {
414414
// This may now be either the file name or the host.
415-
desc = ' (' + description.slice(slashIdx + 1, queryIdx) + ')';
415+
// Include the slash to make it more obvious what we trimmed.
416+
desc = ' (…' + description.slice(slashIdx, queryIdx) + ')';
417+
} else {
418+
// cut out the middle to not exceed the max length
419+
const start = description.slice(slashIdx, slashIdx + descMaxLength / 2);
420+
const end = description.slice(queryIdx - descMaxLength / 2, queryIdx);
421+
desc = ' (' + (slashIdx > 0 ? '…' : '') + start + '…' + end + ')';
416422
}
417423
}
418424
}

0 commit comments

Comments
 (0)