diff --git a/src/modules/actions/apiUpdaters/messages.ts b/src/modules/actions/apiUpdaters/messages.ts index 265f505c0..e87164902 100644 --- a/src/modules/actions/apiUpdaters/messages.ts +++ b/src/modules/actions/apiUpdaters/messages.ts @@ -36,6 +36,7 @@ import { selectViewportIds, selectFirstUnreadId, selectRealLastReadId, + selectChat, } from '../../selectors'; import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers'; @@ -427,6 +428,12 @@ function updateWithLocalMedia( function updateListedAndViewportIds(global: GlobalState, message: ApiMessage) { const { id, chatId } = message; + const chat = selectChat(global, chatId); + const isUnreadChatNotLoaded = chat && chat.unreadCount && !selectListedIds(global, chatId, MAIN_THREAD_ID); + if (isUnreadChatNotLoaded) { + return global; + } + global = updateListedIds(global, chatId, MAIN_THREAD_ID, [id]); if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) {