Skip to content

Commit

Permalink
fix: scroll to the bottom after the state update
Browse files Browse the repository at this point in the history
Closes #1736

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta authored and kittaakos committed Mar 7, 2023
1 parent 7721350 commit fa9777e
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ export class SerialMonitorOutput extends React.Component<
this.state.charCount
);
const [lines, charCount] = truncateLines(newLines, totalCharCount);
this.setState({
lines,
charCount,
});
this.scrollToBottom();
this.setState(
{
lines,
charCount,
},
() => this.scrollToBottom()
);
}),
this.props.clearConsoleEvent(() =>
this.setState({ lines: [], charCount: 0 })
Expand Down

0 comments on commit fa9777e

Please sign in to comment.