fix thread sorting issue (#5976)

This commit is contained in:
cmuangs 2025-07-30 19:15:29 +08:00 committed by GitHub
parent 12c552c987
commit d2f99c36f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,6 +103,7 @@ export const useThreads = create<ThreadState>()((set, get) => ({
[threadId]: {
...state.threads[threadId],
isFavorite: !state.threads[threadId].isFavorite,
updated: Date.now() / 1000,
},
},
}
@ -221,6 +222,7 @@ export const useThreads = create<ThreadState>()((set, get) => ({
[state.currentThreadId as string]: {
...state.threads[state.currentThreadId as string],
assistants: [assistant],
updated: Date.now() / 1000,
},
},
}
@ -249,6 +251,7 @@ export const useThreads = create<ThreadState>()((set, get) => ({
const updatedThread = {
...thread,
title: newTitle,
updated: Date.now() / 1000,
}
updateThread(updatedThread) // External call, order is fine
const newThreads = { ...state.threads, [threadId]: updatedThread }