fix: mark message read

This commit is contained in:
Shivam Mishra
2026-03-05 15:50:37 +05:30
parent 15c710ec01
commit 6a6c3b7c27
+14 -5
View File
@@ -81,12 +81,21 @@ onMounted(async () => {
]);
});
watch(conversation, () => {
store.dispatch('setActiveChat', {
data: {
id: conversation.value.id,
},
watch(conversation, async (newConversation, oldConversation) => {
if (!newConversation?.id) return;
await store.dispatch('setActiveChat', {
data: newConversation,
});
if (
newConversation.id !== oldConversation?.id &&
newConversation.unread_count > 0
) {
store.dispatch('markMessagesRead', {
id: newConversation.id,
});
}
});
useInfiniteScroll(messageListRef, useThrottleFn(fetchMore, 1000), {