Reset desktop chat unread badge when opened

This commit is contained in:
rever-tecnologia 2025-12-09 16:46:53 -03:00
parent 2ea0952f16
commit 58319ec0f9

View file

@ -107,6 +107,7 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
const unreadIds = payload.messages.filter(m => !m.isFromMachine).map(m => m.id as string)
if (unreadIds.length > 0) {
markMachineMessagesRead(ticketId, unreadIds).catch(err => console.error("mark read falhou", err))
setUnreadCount(0)
}
},
(err) => {
@ -218,6 +219,7 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
const handleExpand = async () => {
setIsMinimized(false)
setUnreadCount(0)
try {
await invoke("set_chat_minimized", { ticketId, minimized: false })
} catch (err) {