Oleada UX 7: Chat (presencia, busqueda en historial) y WACRM (metricas para gerencia, notas internas y etiquetas que sobreviven al sync) + fixes de concurrencia
This commit is contained in:
@@ -65,6 +65,9 @@ const playChatBeep = () => {
|
||||
};
|
||||
|
||||
const POLL_MS = 15000;
|
||||
// Presencia: latido explícito cada 30 s mientras la app está abierta (el
|
||||
// backend marca last_seen y "en línea" = actividad en los últimos 2 minutos).
|
||||
const HEARTBEAT_MS = 30000;
|
||||
|
||||
/** Polling global de mensajes nuevos: toast + beep por remitente. Montar una sola vez. */
|
||||
export const useChatNotifications = (intervalMs = POLL_MS) => {
|
||||
@@ -126,9 +129,16 @@ export const useChatNotifications = (intervalMs = POLL_MS) => {
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
const latido = () => {
|
||||
if (!alive) return;
|
||||
odooApi.chatHeartbeat().catch(() => {});
|
||||
};
|
||||
|
||||
fetchUsers();
|
||||
latido();
|
||||
const id = setInterval(fetchUsers, intervalMs);
|
||||
return () => { alive = false; clearInterval(id); };
|
||||
const hb = setInterval(latido, HEARTBEAT_MS);
|
||||
return () => { alive = false; clearInterval(id); clearInterval(hb); };
|
||||
}, [user, intervalMs, navigate]);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user