Message List: Do not mark a message as read in the background (#3383)

This commit is contained in:
Alexander Zinchuk 2023-07-05 13:13:44 +02:00
parent 4e43602146
commit 4244c014cb

View File

@ -79,6 +79,7 @@ import useMedia from '../../hooks/useMedia';
import useLayoutEffectWithPrevDeps from '../../hooks/useLayoutEffectWithPrevDeps'; import useLayoutEffectWithPrevDeps from '../../hooks/useLayoutEffectWithPrevDeps';
import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps';
import useContainerHeight from './hooks/useContainerHeight'; import useContainerHeight from './hooks/useContainerHeight';
import { isBackgroundModeActive } from '../../hooks/useBackgroundMode';
import Loading from '../ui/Loading'; import Loading from '../ui/Loading';
import MessageListContent from './MessageListContent'; import MessageListContent from './MessageListContent';
@ -463,7 +464,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
const isAlreadyFocusing = messageIds && memoFocusingIdRef.current === messageIds[messageIds.length - 1]; const isAlreadyFocusing = messageIds && memoFocusingIdRef.current === messageIds[messageIds.length - 1];
// Animate incoming message // Animate incoming message
if (wasMessageAdded && isAtBottom && !isAlreadyFocusing) { if (wasMessageAdded && isAtBottom && !isAlreadyFocusing && !isBackgroundModeActive()) {
// Break out of `forceLayout` // Break out of `forceLayout`
requestMeasure(() => { requestMeasure(() => {
animateScroll( animateScroll(