mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-13 04:05:04 +03:00
ensure nulls arent passed to sort
Builder Win / Build PluginLoader for Win (push) Has been cancelled
Builder / Build PluginLoader (push) Has been cancelled
Push Updated Plugin Stub to Template / copy-stub (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Type Check / Run type checkers (push) Has been cancelled
Builder Win / Build PluginLoader for Win (push) Has been cancelled
Builder / Build PluginLoader (push) Has been cancelled
Push Updated Plugin Stub to Template / copy-stub (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Type Check / Run type checkers (push) Has been cancelled
This commit is contained in:
@@ -38,11 +38,16 @@ export function AnnouncementsDisplay() {
|
|||||||
setAnnouncements((oldAnnouncements) => {
|
setAnnouncements((oldAnnouncements) => {
|
||||||
const newArr = [...oldAnnouncements, ...newAnnouncements];
|
const newArr = [...oldAnnouncements, ...newAnnouncements];
|
||||||
const setOfIds = new Set(newArr.map((a) => a.id));
|
const setOfIds = new Set(newArr.map((a) => a.id));
|
||||||
return Array.from(setOfIds)
|
return (
|
||||||
.map((id) => newArr.find((a) => a.id === id)!)
|
(
|
||||||
.sort((a, b) => {
|
Array.from(setOfIds)
|
||||||
|
.map((id) => newArr.find((a) => a.id === id))
|
||||||
|
// Typescript doesn't type filter(Boolean) correctly, so I have to assert this
|
||||||
|
.filter(Boolean) as Announcement[]
|
||||||
|
).sort((a, b) => {
|
||||||
return new Date(b.created).getTime() - new Date(a.created).getTime();
|
return new Date(b.created).getTime() - new Date(a.created).getTime();
|
||||||
});
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user