From 5c2435968b6948dfb4f6a45134d38f39e7f48a9f Mon Sep 17 00:00:00 2001 From: Jakub Romanczyk Date: Wed, 6 Mar 2024 22:36:31 +0100 Subject: [PATCH] perf: use only first 5 other participants to generate a title for a Report --- src/libs/ReportUtils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 060b1911605e..5b5bab13300c 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2611,11 +2611,13 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu return formattedName; } - // Not a room or PolicyExpenseChat, generate title from participants - const participantAccountIDs = report?.participantAccountIDs ?? []; + // Not a room or PolicyExpenseChat, generate title from first 5 other participants + const participantAccountIDs = report?.participantAccountIDs?.slice(0, 6) ?? []; const participantsWithoutCurrentUser = participantAccountIDs.filter((accountID) => accountID !== currentUserAccountID); const isMultipleParticipantReport = participantsWithoutCurrentUser.length > 1; - + if (participantsWithoutCurrentUser.length > 5) { + participantsWithoutCurrentUser.pop(); + } return participantsWithoutCurrentUser.map((accountID) => getDisplayNameForParticipant(accountID, isMultipleParticipantReport)).join(', '); }