File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ interface ChatWindowProps extends HeaderProps {
3131 className ?: string ;
3232 showDonation : boolean ;
3333 fullscreen ?: boolean ;
34+ scrollToBottom ?: boolean ;
3435}
3536
3637const messageListId = "chat-window-message-list" ;
@@ -43,6 +44,7 @@ const ChatWindow = ({
4344 showDonation,
4445 onSave,
4546 fullscreen,
47+ scrollToBottom,
4648} : ChatWindowProps ) => {
4749 const [ hasUserScrolled , setHasUserScrolled ] = useState ( false ) ;
4850 const scrollRef = useRef < HTMLDivElement > ( null ) ;
@@ -60,7 +62,7 @@ const ChatWindow = ({
6062
6163 useEffect ( ( ) => {
6264 // Scroll to bottom on re-renders
63- if ( scrollRef && scrollRef . current ) {
65+ if ( scrollToBottom && scrollRef && scrollRef . current ) {
6466 if ( ! hasUserScrolled ) {
6567 scrollRef . current . scrollTop = scrollRef . current . scrollHeight ;
6668 }
Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ const Home: NextPage = () => {
187187 }
188188 : undefined
189189 }
190+ scrollToBottom
190191 />
191192 { tasks . length > 0 && < TaskWindow tasks = { tasks } /> }
192193 </ Expand >
You can’t perform that action at this time.
0 commit comments