Skip to content

Commit 0f8b6de

Browse files
authored
chore: Fix scroll to bottom on reconnect. (#810)
1 parent 9f0ded1 commit 0f8b6de

File tree

1 file changed

+8
-0
lines changed
  • src/modules/Channel/components/MessageList

1 file changed

+8
-0
lines changed

src/modules/Channel/components/MessageList/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { MessageProvider } from '../../../Message/context/MessageProvider';
1818
import { useHandleOnScrollCallback } from '../../../../hooks/useHandleOnScrollCallback';
1919
import { useSetScrollToBottom } from './hooks/useSetScrollToBottom';
2020
import { useScrollBehavior } from './hooks/useScrollBehavior';
21+
import * as utils from '../../context/utils';
2122

2223
const SCROLL_BOTTOM_PADDING = 50;
2324

@@ -87,6 +88,13 @@ const MessageList: React.FC<MessageListProps> = ({
8788
onScrollDownCallback(([messages]) => {
8889
if (messages) {
8990
try {
91+
setTimeout(() => utils.scrollIntoLast(0, scrollRef),
92+
/**
93+
* Rendering MFM takes long time so we need this.
94+
* But later we should find better solution.
95+
*/
96+
1000,
97+
);
9098
// element.scrollTop = scrollHeight - clientHeight;
9199
// scrollRef.current.scrollTop = scrollHeight - clientHeight;
92100
} catch (error) {

0 commit comments

Comments
 (0)