Skip to content

Commit 6b10c6a

Browse files
committed
Cut out the middle instead
1 parent 74f0af6 commit 6b10c6a

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
@@ -622,10 +622,10 @@ describe('ReactFlightAsyncDebugInfo', () => {
622622
"name": "await getData (…/test)",
623623
},
624624
{
625-
"name": "await getData",
625+
"name": "await getData (…/75897c2dcd…13d22b4b16b4)",
626626
},
627627
{
628-
"name": "await getData",
628+
"name": "await getData (/this-is-a-…what-happens)",
629629
},
630630
{
631631
"name": "await getData (/this-is-not)",

0 commit comments

Comments
 (0)