chore: optional chain for sort
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
parent
aefe8d9e32
commit
a0ef6a2211
|
|
@ -252,8 +252,8 @@ function sortEntriesIdByEntryPublishedAt(entries: string[]) {
|
|||
function sortEntriesIdByStarAt(entries: string[]) {
|
||||
const entriesId2Map = entryActions.getFlattenMapEntries()
|
||||
return entries.slice().sort((a, b) => {
|
||||
const aStar = entriesId2Map[a].collections?.createdAt
|
||||
const bStar = entriesId2Map[b].collections?.createdAt
|
||||
const aStar = entriesId2Map[a]?.collections?.createdAt
|
||||
const bStar = entriesId2Map[b]?.collections?.createdAt
|
||||
if (!aStar || !bStar) return 0
|
||||
return bStar.localeCompare(aStar)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue