Message List: Fix animation in small chats
This commit is contained in:
parent
deee9cffc8
commit
7681f5998c
@ -32,7 +32,9 @@ import {
|
|||||||
selectScheduledMessages,
|
selectScheduledMessages,
|
||||||
isMessageInCurrentMessageList,
|
isMessageInCurrentMessageList,
|
||||||
selectScheduledIds,
|
selectScheduledIds,
|
||||||
selectCurrentMessageList, selectRealLastReadId, selectViewportIds,
|
selectCurrentMessageList,
|
||||||
|
selectViewportIds,
|
||||||
|
selectFirstUnreadId,
|
||||||
} from '../../selectors';
|
} from '../../selectors';
|
||||||
import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers';
|
import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers';
|
||||||
|
|
||||||
@ -427,12 +429,12 @@ function updateListedAndViewportIds(global: GlobalState, message: ApiMessage) {
|
|||||||
global = updateListedIds(global, chatId, MAIN_THREAD_ID, [id]);
|
global = updateListedIds(global, chatId, MAIN_THREAD_ID, [id]);
|
||||||
|
|
||||||
if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) {
|
if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) {
|
||||||
// Always keep at least one read message in the viewport list
|
// Always keep the first uread message in the viewport list
|
||||||
const lastReadId = selectRealLastReadId(global, chatId, MAIN_THREAD_ID);
|
const firstUnreadId = selectFirstUnreadId(global, chatId, MAIN_THREAD_ID);
|
||||||
const newGlobal = addViewportId(global, chatId, MAIN_THREAD_ID, id);
|
const newGlobal = addViewportId(global, chatId, MAIN_THREAD_ID, id);
|
||||||
const newViewportIds = selectViewportIds(newGlobal, chatId, MAIN_THREAD_ID);
|
const newViewportIds = selectViewportIds(newGlobal, chatId, MAIN_THREAD_ID);
|
||||||
|
|
||||||
if (!lastReadId || newViewportIds!.includes(lastReadId)) {
|
if (!firstUnreadId || newViewportIds!.includes(firstUnreadId)) {
|
||||||
global = newGlobal;
|
global = newGlobal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user