RED-4590, remove in place sorting, copy arrays.

This commit is contained in:
George 2023-03-21 17:24:34 +02:00
parent 00a648657c
commit bb1a2910d4

View File

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