Skip to content

Commit

Permalink
Added auto scroll to bottom of chat on new messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianca Wentzel committed Dec 11, 2024
1 parent 7f9483f commit 4ab9398
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions assets/js/Containers/FrevaGPT/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ class FrevaGPT extends React.Component {
botOkay: undefined,
showSuggestions: true,
};

this.chatEndRef = React.createRef(null);
}

componentDidUpdate() {
this.chatEndRef.current?.scrollIntoView();
}

async componentDidMount() {
Expand Down Expand Up @@ -319,6 +325,8 @@ class FrevaGPT extends React.Component {

<ChatBlock />

<div ref={this.chatEndRef}/>

{this.state.loading ? (
<Row className="mb-3">
<Col md={1}>
Expand Down

0 comments on commit 4ab9398

Please sign in to comment.