diff --git a/react/src/components/lablupTalkativotUI/VirtualChatMessageList.tsx b/react/src/components/lablupTalkativotUI/VirtualChatMessageList.tsx index 755436f90c..a379f8317a 100644 --- a/react/src/components/lablupTalkativotUI/VirtualChatMessageList.tsx +++ b/react/src/components/lablupTalkativotUI/VirtualChatMessageList.tsx @@ -81,44 +81,46 @@ const VirtualChatMessageList: React.FC = ({ overscan={overscan} ref={virtuosoRef} /> -
- { - const virtuoso = virtuosoRef.current; - switch (type) { - case 'auto': { - virtuoso?.scrollToIndex({ - align: 'end', - behavior: 'auto', - index: 'LAST', - }); - break; - } - case 'click': { - virtuoso?.scrollToIndex({ - align: 'end', - behavior: 'smooth', - index: 'LAST', - }); - break; - } - } + {!_.isEmpty(messages) && ( +
-
+ > + { + const virtuoso = virtuosoRef.current; + switch (type) { + case 'auto': { + virtuoso?.scrollToIndex({ + align: 'end', + behavior: 'auto', + index: 'LAST', + }); + break; + } + case 'click': { + virtuoso?.scrollToIndex({ + align: 'end', + behavior: 'smooth', + index: 'LAST', + }); + break; + } + } + }} + lastMessageContent={_.get(_.last(messages), 'content')} + /> +
+ )} ); };