fix(web): avoid history pagination stack overflow

This commit is contained in:
kingwl
2026-08-04 11:03:45 +08:00
parent 21d2433d97
commit 5201b84863
5 changed files with 106 additions and 2 deletions

View File

@@ -302,7 +302,12 @@ function paginate(
if (!MESSAGE_TYPES.has(event.type) || !isAppendSurfaceEvent(event)) continue
count++
const sources = (event as { sourceEventSeqs?: number[] }).sourceEventSeqs
const groupStart = sources !== undefined && sources.length > 0 ? Math.min(event.seq, ...sources) : event.seq
let groupStart = event.seq
if (sources !== undefined) {
for (const source of sources) {
if (source < groupStart) groupStart = source
}
}
if (count >= maxMessages) {
cut = groupStart
break