add document.hasFocus check for incoming room events (#1252)

This commit is contained in:
Thumbscrew 2023-05-28 16:54:10 +01:00 committed by array-in-a-matrix
parent 8efebf1fde
commit 997abe6a9c

View file

@ -358,7 +358,7 @@ function useEventArrive(roomTimeline, readUptoEvtStore, timelineScrollRef, event
const isViewingLive = roomTimeline.isServingLiveTimeline() && limit.length >= tLength - 1;
const isAttached = timelineScroll.bottom < SCROLL_TRIGGER_POS;
if (isViewingLive && isAttached) {
if (isViewingLive && isAttached && document.hasFocus()) {
limit.setFrom(tLength - limit.maxEvents);
trySendReadReceipt(event);
setEvent(event);