Skip to content

Commit 0ab304d

Browse files
fix: incorrect scroll position when switching DMs (RocketChat#36524)
1 parent 91348ff commit 0ab304d

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/strong-files-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rocket.chat/meteor": patch
3+
---
4+
5+
Fixes scroll issue when moving between channels or DMs

apps/meteor/client/views/room/body/hooks/useRestoreScrollPosition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function useRestoreScrollPosition(rid: string, wait = 100) {
1414
return;
1515
}
1616
const store = RoomManager.getStore(rid);
17-
if (!jumpToRef.current && store?.scroll !== undefined && !store.atBottom) {
17+
if (store?.scroll !== undefined && (!jumpToRef.current || !store.atBottom)) {
1818
node.scrollTop = store.scroll;
1919
node.scrollLeft = 30;
2020
}

0 commit comments

Comments
 (0)