diff --git a/packages/react-chat/src/components/Channels.tsx b/packages/react-chat/src/components/Channels.tsx index 7dacc9d2..a0bcecdb 100644 --- a/packages/react-chat/src/components/Channels.tsx +++ b/packages/react-chat/src/components/Channels.tsx @@ -47,7 +47,7 @@ export function Channels({ isActive={channel.id === activeChannelId} isMuted={channel.isMuted || false} notification={ - notifications[channel.name] > 0 + notifications[channel.name] > 0 && !channel.isMuted ? notifications[channel.name] : undefined } diff --git a/packages/react-chat/src/components/Chat/ChatMessages.tsx b/packages/react-chat/src/components/Chat/ChatMessages.tsx index acdc7570..716890f3 100644 --- a/packages/react-chat/src/components/Chat/ChatMessages.tsx +++ b/packages/react-chat/src/components/Chat/ChatMessages.tsx @@ -24,7 +24,7 @@ export function ChatMessages({ messages, theme }: ChatMessagesProps) { {messages.map((message, idx) => { return ( - + {(idx === 0 || messages[idx - 1].date.getDay() != messages[idx].date.getDay()) && ( diff --git a/packages/react-chat/src/hooks/useMessenger.ts b/packages/react-chat/src/hooks/useMessenger.ts index 37903249..f90e9347 100644 --- a/packages/react-chat/src/hooks/useMessenger.ts +++ b/packages/react-chat/src/hooks/useMessenger.ts @@ -12,6 +12,7 @@ import { ChatMessage } from "../models/ChatMessage"; export function useMessenger(chatId: string, chatIdList: string[]) { const [messenger, setMessenger] = useState(undefined); + const [activeMessages, setActiveMessages] = useState([]); const [messages, setMessages] = useState<{ [chatId: string]: ChatMessage[] }>( {} ); @@ -153,9 +154,13 @@ export function useMessenger(chatId: string, chatIdList: string[]) { [chatId, messenger] ); + useEffect(() => { + setActiveMessages(messages?.[chatId] ?? []); + }, [messages, chatId]); + return { messenger, - messages: messages?.[chatId] ?? [], + messages: activeMessages, sendMessage, notifications, clearNotifications,