feat: granular WebSocket message.new events
- WebSocket now detects new ContactMessages and broadcasts message.new events with contactId, text, channel, direction - Frontend handles message.new: refreshes timeline for open chat, refreshes contacts for sidebar preview update - dashboard.changed still fires for non-message changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -659,6 +659,14 @@ const { crmRealtimeState, startCrmRealtime, stopCrmRealtime } = useCrmRealtime({
|
||||
onDashboardChanged: async () => {
|
||||
await Promise.all([refetchAllCrmQueries(), loadTelegramConnectStatus()]);
|
||||
},
|
||||
onNewMessage: (msg) => {
|
||||
// If the message is for the currently open thread → refresh its timeline
|
||||
if (msg.contactId === selectedCommThreadId.value) {
|
||||
void refreshSelectedClientTimeline(selectedCommThreadId.value);
|
||||
}
|
||||
// Refresh contacts to update sidebar preview (lastMessageText, lastAt)
|
||||
void refetchContacts();
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user