fix: re-anchor new messages divider at last read when tabbing out

This commit is contained in:
Erwan Leboucher committed 2026-07-16 10:06:58 +02:00
1 parent 5123fa0cef
commit 2ec3083b6f
1 file changed
+10 -2
+10 -2
View File
@@ -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]
)
);