diff --git a/web/src/components/ChatBox/ChatMessageList/VirtualizedList.new.tsx b/web/src/components/ChatBox/ChatMessageList/VirtualizedList.new.tsx index bcfd09c4..a04bad4f 100644 --- a/web/src/components/ChatBox/ChatMessageList/VirtualizedList.new.tsx +++ b/web/src/components/ChatBox/ChatMessageList/VirtualizedList.new.tsx @@ -43,11 +43,13 @@ export const VirtualizedMessageList: React.FC = React.memo( } setTimeout(() => { - // 这里 Virtuoso 有个动态渲染高度的bug, 因此需要异步再次滚动到底部 - listRef.current?.scrollToIndex( - PREPEND_OFFSET - numItemsPrepended + props.messages.length - 1 - ); - }, 100); + // 这里 Virtuoso 有个动态渲染高度的bug, 因此需要异步再次滚动到底部以确保代码功能work + listRef.current?.scrollToIndex({ + index: + PREPEND_OFFSET - numItemsPrepended + props.messages.length - 1, + align: 'end', + }); + }, 20); } /**