You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
putReadState: accept an equal-timestamp cursor as a forward move
The guard used a strict > comparison, so a same-millisecond write to
a later message in the same batch was dropped as a no-op and the
route echoed back the older cursor. Only a strictly older timestamp
is a no-op now; an equal timestamp lands the incoming write.
Copy file name to clipboardExpand all lines: packages/chat/src/store.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -311,8 +311,8 @@ export function createDrizzleChatStore<TSchema extends Record<string, unknown>>(
311
311
workbenchReadState.principalId,
312
312
],
313
313
set: {
314
-
lastSeenCreatedAt: sql`CASE WHEN excluded.last_seen_created_at > ${workbenchReadState.lastSeenCreatedAt} THEN excluded.last_seen_created_at ELSE ${workbenchReadState.lastSeenCreatedAt} END`,
315
-
lastSeenId: sql`CASE WHEN excluded.last_seen_created_at > ${workbenchReadState.lastSeenCreatedAt} THEN excluded.last_seen_id ELSE ${workbenchReadState.lastSeenId} END`,
314
+
lastSeenCreatedAt: sql`CASE WHEN excluded.last_seen_created_at >=${workbenchReadState.lastSeenCreatedAt} THEN excluded.last_seen_created_at ELSE ${workbenchReadState.lastSeenCreatedAt} END`,
315
+
lastSeenId: sql`CASE WHEN excluded.last_seen_created_at >=${workbenchReadState.lastSeenCreatedAt} THEN excluded.last_seen_id ELSE ${workbenchReadState.lastSeenId} END`,
316
316
},
317
317
})
318
318
.returning();
@@ -467,7 +467,7 @@ export function createInMemoryChatStore(): ChatStore {
0 commit comments