Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/dashboard/react-components/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ SyntaxHighlighter.registerLanguage('dockerfile', docker);
import type { Message, Agent, Attachment } from '../types';
import { MessageStatusIndicator } from './MessageStatusIndicator';
import { ThinkingIndicator } from './ThinkingIndicator';
import { deduplicateBroadcasts } from './hooks/useBroadcastDedup';

// Provider icons and colors matching landing page
const PROVIDER_CONFIG: Record<string, { icon: string; color: string }> = {
Expand Down Expand Up @@ -127,7 +128,7 @@ export function MessageList({
const isScrollingRef = useRef(false);

// Filter messages for current channel or current thread
const filteredMessages = messages.filter((msg) => {
const channelFilteredMessages = messages.filter((msg) => {
// When a thread is selected, show messages related to that thread
if (currentThread) {
// Show the original message (id matches thread) or replies (thread field matches)
Expand All @@ -148,6 +149,14 @@ export function MessageList({
return msg.from === currentChannel || msg.to === currentChannel;
});

// Deduplicate broadcast messages in #general channel
// When a broadcast is sent to '*', the backend delivers it to each recipient separately,
// causing the same message to appear multiple times. Deduplication removes duplicates
// by grouping broadcasts with the same sender, content, and timestamp.
const filteredMessages = currentChannel === 'general'
? deduplicateBroadcasts(channelFilteredMessages)
: channelFilteredMessages;

// Populate latestMessageToAgent with the latest message from current user to each agent
// Iterate in order (oldest to newest) so the last one wins
for (const msg of filteredMessages) {
Expand Down
Loading
Loading