From bb1a2910d47590285f1237b855373227868827bf Mon Sep 17 00:00:00 2001 From: George Date: Tue, 21 Mar 2023 17:24:34 +0200 Subject: [PATCH] RED-4590, remove in place sorting, copy arrays. --- .../components/notifications/notifications.component.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/red-ui/src/app/components/notifications/notifications.component.ts b/apps/red-ui/src/app/components/notifications/notifications.component.ts index 90b6f15fb..5d9a56c96 100644 --- a/apps/red-ui/src/app/components/notifications/notifications.component.ts +++ b/apps/red-ui/src/app/components/notifications/notifications.component.ts @@ -70,11 +70,10 @@ export class NotificationsComponent { return n.creationDate.split('T')[0]; }); - const grouped = [...groupedMap.entries()]; - const sorted = grouped.sort(([aDate], [bDate]) => chronologically(aDate, bDate)); - return sorted.map(([date, _notifications]) => ({ + const sortedGroups = [...groupedMap.entries()].sort(([aDate], [bDate]) => chronologically(aDate, bDate)); + return sortedGroups.map(([date, _notifications]) => ({ date: isToday(date) ? todayTranslation : this._datePipe.transform(date, 'sophisticatedDate'), - notifications: _notifications.sort((a, b) => chronologically(a.creationDate, b.creationDate)), + notifications: [..._notifications].sort((a, b) => chronologically(a.creationDate, b.creationDate)), })); } }