mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 17:11:17 -08:00
fix: re-anchor new messages divider at last read when tabbing out
This commit is contained in:
1 file changed
+10
-2
@@ -830,9 +830,17 @@ export function RoomTimeline({
|
||||
useDocumentFocusChange(
|
||||
useCallback(
|
||||
(inFocus) => {
|
||||
if (inFocus && atBottomState) tryAutoMarkAsRead();
|
||||
if (inFocus) {
|
||||
if (atBottomState) tryAutoMarkAsRead();
|
||||
return;
|
||||
}
|
||||
// Re-anchor the divider at the last read when tabbing out while caught up.
|
||||
if (atBottomState && timelineSync.liveTimelineLinked) {
|
||||
readUptoEventIdRef.current = undefined;
|
||||
setUnreadInfo(undefined);
|
||||
}
|
||||
},
|
||||
[tryAutoMarkAsRead, atBottomState]
|
||||
[tryAutoMarkAsRead, atBottomState, timelineSync.liveTimelineLinked, setUnreadInfo]
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user