Fix duplicate messages at backup page boundaries

This commit is contained in:
Rolfe Schmidt
2026-09-04 18:22:33 +00:00
committed by GitHub
parent afcd98c72c
commit 5d79a6e190
3 changed files with 130 additions and 3 deletions
+3 -2
View File
@@ -9186,7 +9186,8 @@ function pageBackupMessages(
${MESSAGE_COLUMNS_FRAGMENT}
FROM messages
WHERE
rowid >= ${cursor?.nextRowid ?? 0}
rowid > ${cursor?.lastRowId ?? 0}
ORDER BY rowid ASC
LIMIT ${LIMIT}
`;
const rows: Array<MessageTypeUnhydrated & { rowid: number }> = db
@@ -9194,7 +9195,7 @@ function pageBackupMessages(
.all(params);
return {
cursor: {
nextRowid: rows.at(-1)?.rowid ?? 0,
lastRowId: rows.at(-1)?.rowid ?? 0,
done: rows.length < LIMIT,
} as PageBackupMessagesCursorType,
messages: hydrateMessages(db, rows),