mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-31 16:33:34 +08:00
修复查看更新更新时间变化,消息时间显示月日时分
修复查看更新更新时间变化,消息时间显示月日时分
This commit is contained in:
parent
bd80c13421
commit
4e48584da6
@ -244,10 +244,9 @@ 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 merged = preserveStaleModifiedAt(current, candidate)
|
const existing = byId.get(candidate.id)
|
||||||
const existing = byId.get(merged.id)
|
if (!existing || sessionModifiedTime(candidate) > sessionModifiedTime(existing)) {
|
||||||
if (!existing || sessionModifiedTime(merged) > sessionModifiedTime(existing)) {
|
byId.set(candidate.id, candidate)
|
||||||
byId.set(merged.id, merged)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,21 +269,6 @@ 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