Skip to content

Commit 18c66b1

Browse files
committed
only read unread messages if.. there are any
1 parent 84f7292 commit 18c66b1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/web/Client/Features/Chat/LargeChatComponent.razor

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@
154154
// We call this twice to ensure we're at the very bottom. Silly but easy
155155
await ScrollToBottom();
156156

157-
await ChatService.MarkMessagesAsRead(_activeChat.Id);
158-
_unreadMessages?.Remove(_activeChat.Id);
157+
if (_unreadMessages?.TryGetValue(_activeChat.Id, out _) is true)
158+
{
159+
await ChatService.MarkMessagesAsRead(_activeChat.Id);
160+
_unreadMessages.Remove(_activeChat.Id);
161+
}
159162
}
160163
}
161164

0 commit comments

Comments
 (0)