Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): surface a dead live feed on the Sessions page

Yudhi Armyndharis8ba2e1fc08c3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f46c3b6cc..ee4b62bb4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The dashboard session card keeps showing the phone number, session id and last-active time while a
linked session reconnects, instead of the pairing placeholder that read as an unlinked account
([#1546](https://github.com/rmyndharis/OpenWA/issues/1546)). Thanks @OdaiAhmed99 for the report.
+- The Sessions page reports a dead live-event feed and offers a retry, and re-reads the list once the
+ feed comes back. The socket gives up after five attempts, and the page kept rendering whatever
+ status arrived last with no indication that it had stopped updating.
## [0.23.4] - 2026-09-05
diff --git a/dashboard/src/hooks/useSessionFeed.ts b/dashboard/src/hooks/useSessionFeed.ts
index 3a02269e3..ddaa20ea1 100644
--- a/dashboard/src/hooks/useSessionFeed.ts
+++ b/dashboard/src/hooks/useSessionFeed.ts
@@ -2,10 +2,15 @@ import { useState, useEffect, useRef, useCallback, useMemo } from 'react';
import type { RefObject } from 'react';
import type { Session } from '../services/api';
import { useWebSocket } from './useWebSocket';
+import { nextReconnectState } from '../utils/reconnectState';
import { createSessionFeedState, noteSessionFeedError, subscribeSessionFeed } from '../utils/sessionFeedSubscription';
export interface SessionFeed {
isConnected: boolean;
+ /** The socket is dead until the user retries: attempts exhausted, or the server closed it. */
+ connectionFailed: boolean;
+ /** Drop the dead socket and dial a fresh one. What the page's retry button calls. */
+ reconnect: () => void;
}
export interface UseSessionFeedArgs {
@@ -14,6 +19,11 @@ export interface UseSessionFeedArgs {
onQRCode: (event: { sessionId: string; qrCode: string }) => void;
onSessionStatus: (event: { sessionId: string; status: string }) => void;
onSessionRestriction?: (event: { sessionId: string }) => void;
+ /**
+ * Fired once per RECONNECT, never on the first connect: every push that happened while the socket
+ * was down is gone, so the caller must re-read the list it holds in local state.
+ */
+ onReconnect?: () => void;
}
/**
@@ -33,6 +43,7 @@ export function useSessionFeed({
onQRCode,
onSessionStatus,
onSessionRestriction,
+ onReconnect,
}: UseSessionFeedArgs): SessionFeed {
// Live session-feed subscription state: wildcard first, per-session fallback for scoped keys.
const feedStateRef = useRef(createSessionFeedState());
@@ -55,7 +66,7 @@ export function useSessionFeed({
}),
[onQRCode, onSessionStatus, onSessionRestriction, handleServerError],
);
- const { isConnected, subscribe } = useWebSocket(wsEvents);
+ const { isConnected, connectionFailed, reconnect, subscribe } = useWebSocket(wsEvents);
// Fold a server error frame into the feed state: a session-scoped key may not join the '*'
// room — silently fall back to one subscription per listed session (the list endpoint is
@@ -90,6 +101,25 @@ export function useSessionFeed({
if (!isConnected) feedStateRef.current.subscribedIds.clear();
}, [isConnected]);
+ // Re-subscribing is not enough: the pushes that fired during the gap are gone for good, and the
+ // caller keeps its list in local state with no polling behind it, so a card would render its
+ // pre-gap status until the operator reloaded the page. Tell the caller to re-read, on the RECONNECT
+ // only and never on the first connect (nothing is cached yet, and the caller already fetched at
+ // mount). Same pure transition the Chats page uses, and idempotent: a re-run caused by a changed
+ // `onReconnect` identity sees the gap marker already cleared and does not fetch twice.
+ const hadConnected = useRef(false);
+ const wasDisconnected = useRef(false);
+ useEffect(() => {
+ const decision = nextReconnectState({
+ isConnected,
+ hadConnected: hadConnected.current,
+ wasDisconnected: wasDisconnected.current,
+ });
+ hadConnected.current = decision.hadConnected;
+ wasDisconnected.current = decision.wasDisconnected;
+ if (decision.invalidate) onReconnect?.();
+ }, [isConnected, onReconnect]);
+
// In per-session mode, sessions loaded/created after the fallback still need their rooms.
useEffect(() => {
if (isConnected && feedStateRef.current.scope === 'per-session') {
@@ -101,5 +131,5 @@ export function useSessionFeed({
}
}, [isConnected, sessions, subscribe]);
- return { isConnected };
+ return { isConnected, connectionFailed, reconnect };
}
diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.json
index 93bdecc7a..7996aa204 100644
--- a/dashboard/src/i18n/locales/ar.json
+++ b/dashboard/src/i18n/locales/ar.json
@@ -258,6 +258,7 @@
"sessions": {
"title": "الجلسات",
"subtitle": "إدارة جلسات واتساب واتصالات رمز QR",
+ "feedDisconnected": "انقطعت التحديثات المباشرة",
"newSession": "جلسة جديدة",
"searchPlaceholder": "بحث في الجلسات...",
"filter": {
diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.json
index 4176d3eb5..022352286 100644
--- a/dashboard/src/i18n/locales/de.json
+++ b/dashboard/src/i18n/locales/de.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "Sitzungen",
"subtitle": "WhatsApp-Sitzungen und QR-Code-Verbindungen verwalten",
+ "feedDisconnected": "Live-Updates getrennt",
"newSession": "Neue Sitzung",
"searchPlaceholder": "Sitzungen durchsuchen...",
"filter": {
diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.json
index 8a7ef1deb..776816e99 100644
--- a/dashboard/src/i18n/locales/en.json
+++ b/dashboard/src/i18n/locales/en.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "Sessions",
"subtitle": "Manage your WhatsApp sessions and QR code connections",
+ "feedDisconnected": "Live updates disconnected",
"newSession": "New Session",
"searchPlaceholder": "Search sessions...",
"filter": {
diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.json
index 31ce111cb..d17dbe294 100644
--- a/dashboard/src/i18n/locales/es.json
+++ b/dashboard/src/i18n/locales/es.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "Sesiones",
"subtitle": "Gestiona tus sesiones de WhatsApp y conexiones por código QR",
+ "feedDisconnected": "Actualizaciones en vivo desconectadas",
"newSession": "Nueva sesión",
"searchPlaceholder": "Buscar sesiones...",
"filter": {
diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.json
index 5d0a47224..915190835 100644
--- a/dashboard/src/i18n/locales/fr.json
+++ b/dashboard/src/i18n/locales/fr.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "Sessions",
"subtitle": "Gérez vos sessions WhatsApp et vos connexions par code QR",
+ "feedDisconnected": "Mises à jour en direct interrompues",
"newSession": "Nouvelle session",
"searchPlaceholder": "Rechercher des sessions...",
"filter": {
diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.json
index ab934fdce..d3a1d4590 100644
--- a/dashboard/src/i18n/locales/he.json
+++ b/dashboard/src/i18n/locales/he.json
@@ -254,6 +254,7 @@
"sessions": {
"title": "Sessions",
"subtitle": "ניהול Sessions של WhatsApp והתחברות באמצעות QR",
+ "feedDisconnected": "עדכונים בזמן אמת נותקו",
"newSession": "Session חדש",
"searchPlaceholder": "חיפוש Sessions...",
"filter": {
diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.json
index 4ce838c7c..18b17e497 100644
--- a/dashboard/src/i18n/locales/it.json
+++ b/dashboard/src/i18n/locales/it.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "Sessioni",
"subtitle": "Gestisci le tue sessioni WhatsApp e le connessioni tramite codice QR",
+ "feedDisconnected": "Aggiornamenti in tempo reale disconnessi",
"newSession": "Nuova Sessione",
"searchPlaceholder": "Cerca sessioni...",
"filter": {
diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.json
index 019c9b828..4b0853d3a 100644
--- a/dashboard/src/i18n/locales/ko.json
+++ b/dashboard/src/i18n/locales/ko.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "세션",
"subtitle": "WhatsApp 세션과 QR 코드 연결을 관리하세요",
+ "feedDisconnected": "실시간 업데이트 연결 끊김",
"newSession": "새 세션",
"searchPlaceholder": "세션 검색...",
"filter": {
diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.json
index 5d57d0c24..2ea1c60a6 100644
--- a/dashboard/src/i18n/locales/pt-BR.json
+++ b/dashboard/src/i18n/locales/pt-BR.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "Sessões",
"subtitle": "Gerencie suas sessões do WhatsApp e conexões por código QR",
+ "feedDisconnected": "Atualizações em tempo real desconectadas",
"newSession": "Nova sessão",
"searchPlaceholder": "Pesquisar sessões...",
"filter": {
diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.json
index 6cecb7d6d..0d3eef534 100644
--- a/dashboard/src/i18n/locales/te.json
+++ b/dashboard/src/i18n/locales/te.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "సెషన్స్",
"subtitle": "మీ వాట్సాప్ సెషన్లు మరియు QR కోడ్ కనెక్షన్లను నిర్వహించండి",
+ "feedDisconnected": "ప్రత్యక్ష నవీకరణలు డిస్‌కనెక్ట్ అయ్యాయి",
"newSession": "కొత్త సెషన్",
"searchPlaceholder": "సెషన్ల కోసం వెతకండి...",
"filter": {
diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.json
index 665d8adc1..fa60b67ea 100644
--- a/dashboard/src/i18n/locales/tr.json
+++ b/dashboard/src/i18n/locales/tr.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "Oturumlar",
"subtitle": "WhatsApp oturumlarınızı ve QR kodu bağlantılarınızı yönetin",
+ "feedDisconnected": "Canlı güncellemeler kesildi",
"newSession": "Yeni Oturum",
"searchPlaceholder": "Oturumlarda ara...",
"filter": {
diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.json
index 6be92b41f..e98b97411 100644
--- a/dashboard/src/i18n/locales/zh-CN.json
+++ b/dashboard/src/i18n/locales/zh-CN.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "会话",
"subtitle": "管理你的 WhatsApp 会话和 QR 码连接",
+ "feedDisconnected": "实时更新已断开",
"newSession": "新建会话",
"searchPlaceholder": "搜索会话...",
"filter": {
diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.json
index 3f5e34d8e..4481ffa7e 100644
--- a/dashboard/src/i18n/locales/zh-HK.json
+++ b/dashboard/src/i18n/locales/zh-HK.json
@@ -247,6 +247,7 @@
"sessions": {
"title": "工作階段",
"subtitle": "管理你的 WhatsApp 工作階段及 QR 碼連線",
+ "feedDisconnected": "即時更新已中斷",
"newSession": "新增工作階段",
"searchPlaceholder": "搜尋工作階段...",
"filter": {
diff --git a/dashboard/src/pages/Sessions.tsx b/dashboard/src/pages/Sessions.tsx
index 30733730f..a4f8a2630 100644
--- a/dashboard/src/pages/Sessions.tsx
+++ b/dashboard/src/pages/Sessions.tsx
@@ -15,6 +15,7 @@ import {
Skull,
Unlink,
Globe,
+ AlertCircle,
} from 'lucide-react';
import {
sessionApi,
@@ -188,16 +189,22 @@ export function Sessions() {
[queryClient, dismissQrForSession],
);
- useSessionFeed({
+ // A restriction push and a recovered socket mean the same thing to this page: the local list may be
+ // behind the server, re-read it. (The badge renders from the server projection
+ // `session.restriction`, and a restriction can arrive with no status transition at all, because the
+ // Baileys reachout timelock rides a connect probe, so that push is purely a refetch signal.)
+ const refetchSessions = useCallback(() => {
+ void fetchSessions();
+ }, [fetchSessions]);
+
+ const { connectionFailed, reconnect } = useSessionFeed({
sessions,
sessionsRef,
onQRCode: applyQrPush,
- // The badge renders from the server projection (`session.restriction`), and a restriction can
- // arrive with no status transition at all (the Baileys reachout timelock rides a connect
- // probe) — so the push is purely a refetch signal.
- onSessionRestriction: useCallback(() => {
- void fetchSessions();
- }, [fetchSessions]),
+ onSessionRestriction: refetchSessions,
+ // Everything pushed during a socket gap is lost, and nothing else on this page re-reads the list
+ // after mount, so a card would sit on its pre-gap status until the operator reloaded.
+ onReconnect: refetchSessions,
onSessionStatus: useCallback(
(event: { sessionId: string; status: string }) => {
const prev = sessionsRef.current.find(s => s.id === event.sessionId);
@@ -512,6 +519,19 @@ export function Sessions() {
}
/>
+ {/* The live feed is dead until the operator retries: the socket exhausted its attempts, or the
+ server closed it. Without this the cards freeze on their last pushed status and a session
+ that has since dropped is indistinguishable from a healthy idle page. */}
+ {connectionFailed && (
+ <div className="error-banner" role="alert">
+ <AlertCircle size={20} />
+ <span className="error-banner-text">{t('sessions.feedDisconnected')}</span>
+ <button className="btn-secondary" style={{ marginLeft: 'auto' }} onClick={reconnect}>
+ {t('common.refresh')}
+ </button>
+ </div>
+ )}
+
<div className="filters-bar">
<div className="search-input">
<Search size={18} />