Fix session history order when sidebar refresh merges stale server timestamps.

Keep the newer updated_at and max message_count during session list merges so local touchSession updates are not overwritten by lagging Goose summaries.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-02 14:59:38 +08:00
parent 1d1af5c657
commit e370583fc0
3 changed files with 90 additions and 8 deletions
+4 -1
View File
@@ -88,6 +88,7 @@ import {
appendSessionLists,
prependUnique,
shouldShowNewChatTitle,
sortAndTrim,
toSessionSummary,
touchSession,
} from '../utils/sessions';
@@ -750,7 +751,9 @@ export function useTKMindChat(
offset: 0,
query: options?.query ?? sessionSearchQueryRef.current,
});
const merged = options?.preserveExisting ? appendSessionLists(sessionsRef.current, items) : items;
const merged = options?.preserveExisting
? appendSessionLists(sessionsRef.current, items)
: sortAndTrim(items);
const nextOffset = Number(page.offset ?? 0) + items.length;
const total = Math.max(Number(page.total ?? merged.length), merged.length);
sessionsOffsetRef.current = options?.preserveExisting