fix: threads sorting order after updated (#4319)
This commit is contained in:
parent
1f4c00dc41
commit
365cdfa333
@ -200,12 +200,12 @@ export const updateThreadAtom = atom(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// sort new threads based on updated at
|
// sort new threads based on updated at
|
||||||
threads.sort((thread1, thread2) => {
|
threads.sort((a, b) => {
|
||||||
const aDate = new Date(thread1.updated ?? 0)
|
return ((a.metadata?.updated_at as number) ?? 0) >
|
||||||
const bDate = new Date(thread2.updated ?? 0)
|
((b.metadata?.updated_at as number) ?? 0)
|
||||||
return bDate.getTime() - aDate.getTime()
|
? -1
|
||||||
|
: 1
|
||||||
})
|
})
|
||||||
|
|
||||||
set(threadsAtom, threads)
|
set(threadsAtom, threads)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user