mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
修复查看更新更新时间变化,消息时间显示月日时分
修复查看更新更新时间变化,消息时间显示月日时分
This commit is contained in:
parent
bd80c13421
commit
4e48584da6
@ -244,10 +244,9 @@ function mergeSessionList(
|
||||
for (const item of incoming) {
|
||||
const current = currentById.get(item.id)
|
||||
const candidate = preserveLocalTitle(current, item)
|
||||
const merged = preserveStaleModifiedAt(current, candidate)
|
||||
const existing = byId.get(merged.id)
|
||||
if (!existing || sessionModifiedTime(merged) > sessionModifiedTime(existing)) {
|
||||
byId.set(merged.id, merged)
|
||||
const existing = byId.get(candidate.id)
|
||||
if (!existing || sessionModifiedTime(candidate) > sessionModifiedTime(existing)) {
|
||||
byId.set(candidate.id, candidate)
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,21 +269,6 @@ function preserveLocalTitle(
|
||||
return incoming
|
||||
}
|
||||
|
||||
function preserveStaleModifiedAt(
|
||||
current: SessionListItem | undefined,
|
||||
incoming: SessionListItem,
|
||||
): SessionListItem {
|
||||
if (!current) return incoming
|
||||
// Preserve modifiedAt when the effective title hasn't changed — indicates no meaningful
|
||||
// content change. messageCount is NOT used here because listSessions always returns 0
|
||||
// (a placeholder for performance), while fetchSessionSummary returns the real count,
|
||||
// so comparing them would always fail and defeat the preservation logic.
|
||||
if (current.title === incoming.title) {
|
||||
return { ...incoming, modifiedAt: current.modifiedAt }
|
||||
}
|
||||
return incoming
|
||||
}
|
||||
|
||||
function syncOpenSessionTabTitles(sessions: SessionListItem[]): void {
|
||||
const titleById = new Map(sessions.map((session) => [session.id, session.title]))
|
||||
const { tabs, updateTabTitle } = useTabStore.getState()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user