Fix msg timeline keep scrolling when not in focus
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
181382b2b7
commit
631ce7645f
1 changed files with 4 additions and 0 deletions
|
@ -453,6 +453,8 @@ function useEventArrive(roomTimeline, readEventStore) {
|
||||||
readEventStore.setItem(roomTimeline.findEventByIdInTimelineSet(readUpToId));
|
readEventStore.setItem(roomTimeline.findEventByIdInTimelineSet(readUpToId));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// user has not mark room as read
|
||||||
const isUnreadMsg = readUpToEvent?.getId() === readUpToId;
|
const isUnreadMsg = readUpToEvent?.getId() === readUpToId;
|
||||||
if (!isUnreadMsg) {
|
if (!isUnreadMsg) {
|
||||||
roomTimeline.markAllAsRead();
|
roomTimeline.markAllAsRead();
|
||||||
|
@ -509,6 +511,8 @@ function useEventArrive(roomTimeline, readEventStore) {
|
||||||
&& !roomTimeline.canPaginateForward()
|
&& !roomTimeline.canPaginateForward()
|
||||||
&& document.visibilityState === 'visible') {
|
&& document.visibilityState === 'visible') {
|
||||||
timelineScroll.scrollToBottom();
|
timelineScroll.scrollToBottom();
|
||||||
|
} else {
|
||||||
|
timelineScroll.tryRestoringScroll();
|
||||||
}
|
}
|
||||||
}, [newEvent, roomTimeline]);
|
}, [newEvent, roomTimeline]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue