From: Ajay Bura Date: Wed, 15 Dec 2021 11:56:22 +0000 (+0530) Subject: Fix msg timeline keep scrolling when not in focus X-Git-Tag: v1.6.1~11 X-Git-Url: https://git.wafflesoft.org/?a=commitdiff_plain;h=631ce7645fd168db63bc64f5424a34145c5022b8;p=rainny.git Fix msg timeline keep scrolling when not in focus Signed-off-by: Ajay Bura --- diff --git a/src/app/organisms/room/RoomViewContent.jsx b/src/app/organisms/room/RoomViewContent.jsx index c26fbd8..364d35d 100644 --- a/src/app/organisms/room/RoomViewContent.jsx +++ b/src/app/organisms/room/RoomViewContent.jsx @@ -453,6 +453,8 @@ function useEventArrive(roomTimeline, readEventStore) { readEventStore.setItem(roomTimeline.findEventByIdInTimelineSet(readUpToId)); return; } + + // user has not mark room as read const isUnreadMsg = readUpToEvent?.getId() === readUpToId; if (!isUnreadMsg) { roomTimeline.markAllAsRead(); @@ -509,6 +511,8 @@ function useEventArrive(roomTimeline, readEventStore) { && !roomTimeline.canPaginateForward() && document.visibilityState === 'visible') { timelineScroll.scrollToBottom(); + } else { + timelineScroll.tryRestoringScroll(); } }, [newEvent, roomTimeline]); }