Skip to content

Commit 65efc84

Browse files
committed
Cut out the middle instead
1 parent d756c04 commit 65efc84

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/react-client/src/ReactFlightPerformanceTrack.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ function getIOShortName(
414414
// This may now be either the file name or the host.
415415
// Include the slash to make it more obvious what we trimmed.
416416
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 + ')';
417422
}
418423
}
419424
}

packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,10 @@ describe('ReactFlightAsyncDebugInfo', () => {
621621
"name": "await getData (…/test)",
622622
},
623623
{
624-
"name": "await getData",
624+
"name": "await getData (…/75897c2dcd…13d22b4b16b4)",
625625
},
626626
{
627-
"name": "await getData",
627+
"name": "await getData (/this-is-a-…what-happens)",
628628
},
629629
{
630630
"name": "await getData (/this-is-not)",

0 commit comments

Comments
 (0)