diff --git a/src/api/fetch-notes.ts b/src/api/fetch-notes.ts index a8266f6..68659bf 100644 --- a/src/api/fetch-notes.ts +++ b/src/api/fetch-notes.ts @@ -34,5 +34,8 @@ export const fetchNotes = async (): Promise => { 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, + ) }