diff --git a/arduino-ide-extension/src/browser/serial/monitor/monitor-widget.tsx b/arduino-ide-extension/src/browser/serial/monitor/monitor-widget.tsx index a5a25230c..ec83f5a0a 100644 --- a/arduino-ide-extension/src/browser/serial/monitor/monitor-widget.tsx +++ b/arduino-ide-extension/src/browser/serial/monitor/monitor-widget.tsx @@ -117,6 +117,11 @@ export class MonitorWidget extends ReactWidget { (this.focusNode || this.node).focus(); } + protected override onAfterShow(msg: Message): void { + super.onAfterShow(msg); + this.update(); + } + protected onFocusResolved = (element: HTMLElement | undefined) => { if (this.closing || !this.isAttached) { return; 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..2ddd2c565 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 @@ -17,7 +17,7 @@ export class SerialMonitorOutput extends React.Component< * Do not touch it. It is used to be able to "follow" the serial monitor log. */ protected toDisposeBeforeUnmount = new DisposableCollection(); - private listRef: React.RefObject; + private listRef: React.RefObject; constructor(props: Readonly) { super(props); @@ -34,12 +34,10 @@ export class SerialMonitorOutput extends React.Component< this.scrollToBottom() + ); }), this.props.clearConsoleEvent(() => this.setState({ lines: [], charCount: 0 }) @@ -91,11 +91,11 @@ export class SerialMonitorOutput extends React.Component< this.toDisposeBeforeUnmount.dispose(); } - scrollToBottom = ((): void => { + private readonly scrollToBottom = () => { if (this.listRef.current && this.props.monitorModel.autoscroll) { this.listRef.current.scrollToItem(this.state.lines.length, 'end'); } - }).bind(this); + }; } const _Row = ({