Skip to content

Commit

Permalink
fix: threads sorting order after updated (#4319)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Dec 23, 2024
1 parent 1f4c00d commit 365cdfa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/helpers/atoms/Thread.atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ export const updateThreadAtom = atom(
)

// sort new threads based on updated at
threads.sort((thread1, thread2) => {
const aDate = new Date(thread1.updated ?? 0)
const bDate = new Date(thread2.updated ?? 0)
return bDate.getTime() - aDate.getTime()
threads.sort((a, b) => {
return ((a.metadata?.updated_at as number) ?? 0) >
((b.metadata?.updated_at as number) ?? 0)
? -1
: 1
})

set(threadsAtom, threads)
}
)
Expand Down

0 comments on commit 365cdfa

Please sign in to comment.