fix: reset cursor when history changes

This commit is contained in:
Aleksey Bragin
2026-01-14 19:58:56 -05:00
parent 9995b680f7
commit acb16bcb27
2 changed files with 16 additions and 2 deletions
+3 -2
View File
@@ -57,8 +57,9 @@ export function getNewMessages<T extends CursorMessage>(
const lastIndex = keys.lastIndexOf(cursor.lastKey)
if (lastIndex >= 0) {
startIndex = lastIndex + 1
} else if (cursor.lastCount <= messages.length) {
startIndex = cursor.lastCount
} else {
// History changed without a shrink; reset to avoid skipping messages.
startIndex = 0
}
}
}