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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user