add document.hasFocus check for incoming room events (#1252)
authorThumbscrew <thumbscrw@pm.me>
Sun, 28 May 2023 15:54:10 +0000 (16:54 +0100)
committerGitHub <noreply@github.com>
Sun, 28 May 2023 15:54:10 +0000 (21:24 +0530)
src/app/organisms/room/RoomViewContent.jsx

index 74bc7e268ae765948299b72e52882ab322b35ebb..0a9256cebca1070e520b865e7cf7be79bb698bd4 100644 (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);