Close reconnect gap causing dropped real-time messages

Fixkamo-internal
Shipped
April 25, 2026 at 4:43 PM UTC
Author
kamo
Commit
fdc91d2

Remove `connected` from subscription useEffect deps in TicketChat and ChatBox. Previously, every WebSocket reconnect triggered the effect cleanup which called unsubscribe(), deleted the session from the subscription map, and sent /app/chat/unsubscribe to the backend — disabling the NATS→STOMP bridge. **************** in onConnect found nothing to reattach, and any visitor message or system event (NAME_CHANGED) that arrived in the gap was permanently lost. Removing the dep means onConnect handles reconnects without any teardown. Also fix SupportCountContext to subtract focusedSessionsRef.current.size from both the 60-second poll and the PENDING_COUNT WS handler, so the support badge stays decremented while the agent has a ticket focused (backend still counts it as pending with no mark-viewed API). Add markAsRead useEffect in ChatBox keyed to sessionGuid so the Interaction Center unread count decrements whenever a chat window opens, not only when a new in-session message happens to arrive.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing