refactor(notes): sort fetched notes by publishedAt desc

Centralise ordering in fetchNotes so every consumer (homepage, /pub
index, RSS feed) shares the same newest-first order.
This commit is contained in:
Julien Calixte
2026-05-23 16:52:01 +02:00
parent ffad0ecf54
commit 3153200eb3

View File

@@ -34,5 +34,8 @@ export const fetchNotes = async (): Promise<Note[]> => {
limit: 50,
})
return (records || []).map((record) => record.value)
const notes = (records || []).map((record) => record.value as Note)
return notes.sort((a, b) =>
a.publishedAt < b.publishedAt ? 1 : a.publishedAt > b.publishedAt ? -1 : 0,
)
}