diff --git a/.changeset/strange-stingrays-live.md b/.changeset/strange-stingrays-live.md new file mode 100644 index 0000000000000..2c1e59661c42a --- /dev/null +++ b/.changeset/strange-stingrays-live.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Fixes scroll issue when moving between channels or DMs diff --git a/apps/meteor/client/views/room/body/hooks/useRestoreScrollPosition.spec.tsx b/apps/meteor/client/views/room/body/hooks/useRestoreScrollPosition.spec.tsx index fbf95db89753a..9f0bdbbe98b13 100644 --- a/apps/meteor/client/views/room/body/hooks/useRestoreScrollPosition.spec.tsx +++ b/apps/meteor/client/views/room/body/hooks/useRestoreScrollPosition.spec.tsx @@ -36,6 +36,30 @@ describe('useRestoreScrollPosition', () => { expect(screen.getByTestId('scrollable-element')).toHaveProperty('scrollTop', 123); }); + it('should jump to bottom if atBottom is true', () => { + const store = { + scroll: 123, + atBottom: true, + update: jest.fn(), + }; + (RoomManager.getStore as jest.Mock).mockReturnValue(store); + + const Test = () => { + const { innerRef } = useRestoreScrollPosition('GENERAL'); + return ( +