Drain before autofetch, fix same-second collisions, and always mc.disconnect() on false/probe failure

This commit is contained in:
Jack Kingsman
2026-02-23 17:33:35 -08:00
parent 619973bdf0
commit cba9e20698
5 changed files with 427 additions and 16 deletions
@@ -50,7 +50,11 @@ function mergePendingAck(
// Generate a key for deduplicating messages by content
export function getMessageContentKey(msg: Message): string {
return `${msg.type}-${msg.conversation_key}-${msg.text}-${msg.sender_timestamp}`;
// When sender_timestamp exists, dedup by content (catches radio-path duplicates with different IDs).
// When null, include msg.id so each message gets a unique key — avoids silently dropping
// different messages that share the same text and received_at second.
const ts = msg.sender_timestamp ?? `r${msg.received_at}-${msg.id}`;
return `${msg.type}-${msg.conversation_key}-${msg.text}-${ts}`;
}
export interface UseConversationMessagesResult {