fix: scroll to the bottom after the state update

Closes #1736

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta 2023-03-03 08:41:05 +01:00 committed by Akos Kitta
parent 77213507fb
commit fa9777e529

View File

@ -65,11 +65,13 @@ export class SerialMonitorOutput extends React.Component<
this.state.charCount
);
const [lines, charCount] = truncateLines(newLines, totalCharCount);
this.setState({
this.setState(
{
lines,
charCount,
});
this.scrollToBottom();
},
() => this.scrollToBottom()
);
}),
this.props.clearConsoleEvent(() =>
this.setState({ lines: [], charCount: 0 })