Message List: Fix losing scroll position in unread chats

This commit is contained in:
Alexander Zinchuk 2021-06-29 17:23:30 +03:00
parent a6d0f5a220
commit f3e66ad75e

View File

@ -471,7 +471,7 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
} else if (anchor) {
const newAnchorTop = anchor.getBoundingClientRect().top;
newScrollTop = scrollTop + (newAnchorTop - (anchorTopRef.current || 0));
} else if (unreadDivider) {
} else if (unreadDivider && !scrollOffset) {
newScrollTop = unreadDivider.offsetTop - (hasTools ? UNREAD_DIVIDER_TOP_WITH_TOOLS : UNREAD_DIVIDER_TOP);
} else {
newScrollTop = scrollHeight - scrollOffset;