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)), })); } }