We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab3b69f commit 2384f6cCopy full SHA for 2384f6c
frontend/src/components/AnnouncementsDisplay.tsx
@@ -38,11 +38,16 @@ export function AnnouncementsDisplay() {
38
setAnnouncements((oldAnnouncements) => {
39
const newArr = [...oldAnnouncements, ...newAnnouncements];
40
const setOfIds = new Set(newArr.map((a) => a.id));
41
- return Array.from(setOfIds)
42
- .map((id) => newArr.find((a) => a.id === id)!)
43
- .sort((a, b) => {
+ return (
+ (
+ Array.from(setOfIds)
44
+ .map((id) => newArr.find((a) => a.id === id))
45
+ // Typescript doesn't type filter(Boolean) correctly, so I have to assert this
46
+ .filter(Boolean) as Announcement[]
47
+ ).sort((a, b) => {
48
return new Date(b.created).getTime() - new Date(a.created).getTime();
- });
49
+ })
50
+ );
51
});
52
}
53
0 commit comments