File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,13 @@ export function ConversationList({
9898
9999 const conversations = useMemo ( ( ) => {
100100 const base = conversationsByCwd [ cwd || "" ] || [ ] ;
101+ const sorted = [ ...base ] . sort ( ( a , b ) => {
102+ const aTime = a . timestamp ? new Date ( a . timestamp ) . getTime ( ) : 0 ;
103+ const bTime = b . timestamp ? new Date ( b . timestamp ) . getTime ( ) : 0 ;
104+ return bTime - aTime ;
105+ } ) ;
101106 const query = searchQuery . trim ( ) . toLowerCase ( ) ;
102- return base . filter ( ( conv ) => {
107+ return sorted . filter ( ( conv ) => {
103108 if ( mode === "favorites" && ! favoriteIds . has ( conv . conversationId ) ) {
104109 return false ;
105110 }
Original file line number Diff line number Diff line change @@ -50,12 +50,16 @@ export const useConversationListStore = create<
5050 existingItem ?. timestamp ??
5151 new Date ( ) . toISOString ( ) ,
5252 } ;
53- const nextList =
54- index >= 0
55- ? existingList . map ( ( item , idx ) =>
56- idx === index ? { ...item , ...summaryWithTimestamp } : item ,
57- )
58- : [ ...existingList , summaryWithTimestamp ] ;
53+ const mergedConversation =
54+ existingItem === null
55+ ? summaryWithTimestamp
56+ : { ...existingItem , ...summaryWithTimestamp } ;
57+ const nextList = [
58+ mergedConversation ,
59+ ...existingList . filter (
60+ ( item ) => item . conversationId !== summaryWithTimestamp . conversationId ,
61+ ) ,
62+ ] ;
5963
6064 return {
6165 conversationsByCwd : {
You can’t perform that action at this time.
0 commit comments