From fa9777e529b36c82a3a8bb9456782cb431c60f23 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Fri, 3 Mar 2023 08:41:05 +0100 Subject: [PATCH] fix: scroll to the bottom after the state update Closes #1736 Signed-off-by: Akos Kitta --- .../serial/monitor/serial-monitor-send-output.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx b/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx index 136180202..12142f654 100644 --- a/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx +++ b/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx @@ -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 })