fix: stop aggressive 2s chat polling, use WebSocket instead

- Add refetchChatMessages + refetchChatConversations to
  refetchAllCrmQueries so WebSocket dashboard.changed events
  cover pilot chat updates
- Reduce background polling from 2s to 30s (fallback only)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ruslan Bakiev
2026-02-24 15:41:58 +07:00
parent 19d001815c
commit 195df8e16a
2 changed files with 3 additions and 1 deletions

View File

@@ -308,6 +308,8 @@ async function refetchAllCrmQueries() {
refetchFeed(), refetchFeed(),
refetchPins(), refetchPins(),
refetchDocuments(), refetchDocuments(),
refetchChatMessages(),
refetchChatConversations(),
]); ]);
await refreshSelectedClientTimeline(); await refreshSelectedClientTimeline();
} }

View File

@@ -619,7 +619,7 @@ export function usePilotChat(opts: {
pilotBackgroundPoll = setInterval(() => { pilotBackgroundPoll = setInterval(() => {
if (!opts.authMe.value) return; if (!opts.authMe.value) return;
loadPilotMessages().catch(() => {}); loadPilotMessages().catch(() => {});
}, 2000); }, 30_000);
} }
function stopPilotBackgroundPolling() { function stopPilotBackgroundPolling() {