mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-27 15:13:37 +08:00
修复查看更新更新时间变化,消息时间显示月日时分
修复查看更新更新时间变化,消息时间显示月日时分
This commit is contained in:
parent
eddaec547e
commit
b645152255
@ -244,9 +244,10 @@ function mergeSessionList(
|
|||||||
for (const item of incoming) {
|
for (const item of incoming) {
|
||||||
const current = currentById.get(item.id)
|
const current = currentById.get(item.id)
|
||||||
const candidate = preserveLocalTitle(current, item)
|
const candidate = preserveLocalTitle(current, item)
|
||||||
const existing = byId.get(candidate.id)
|
const merged = preserveStaleModifiedAt(current, candidate)
|
||||||
if (!existing || sessionModifiedTime(candidate) > sessionModifiedTime(existing)) {
|
const existing = byId.get(merged.id)
|
||||||
byId.set(candidate.id, candidate)
|
if (!existing || sessionModifiedTime(merged) > sessionModifiedTime(existing)) {
|
||||||
|
byId.set(merged.id, merged)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,6 +270,21 @@ function preserveLocalTitle(
|
|||||||
return incoming
|
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 {
|
function syncOpenSessionTabTitles(sessions: SessionListItem[]): void {
|
||||||
const titleById = new Map(sessions.map((session) => [session.id, session.title]))
|
const titleById = new Map(sessions.map((session) => [session.id, session.title]))
|
||||||
const { tabs, updateTabTitle } = useTabStore.getState()
|
const { tabs, updateTabTitle } = useTabStore.getState()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user