diff --git a/arduino-ide-extension/src/browser/monitor/monitor-widget.tsx b/arduino-ide-extension/src/browser/monitor/monitor-widget.tsx index 27c77ffd..521dcfd9 100644 --- a/arduino-ide-extension/src/browser/monitor/monitor-widget.tsx +++ b/arduino-ide-extension/src/browser/monitor/monitor-widget.tsx @@ -34,6 +34,11 @@ export class MonitorWidget extends ReactWidget { * Do not touch or use it. It is for setting the focus on the `input` after the widget activation. */ protected focusNode: HTMLElement | undefined; + /** + * Guard against re-rendering the view after the close was requested. + * See: https://github.com/eclipse-theia/theia/issues/6704 + */ + protected closing = false; protected readonly clearOutputEmitter = new Emitter(); constructor() { @@ -67,6 +72,7 @@ export class MonitorWidget extends ReactWidget { } onCloseRequest(msg: Message): void { + this.closing = true; this.monitorConnection.autoConnect = false; if (this.monitorConnection.connected) { this.monitorConnection.disconnect(); @@ -74,6 +80,12 @@ export class MonitorWidget extends ReactWidget { super.onCloseRequest(msg); } + protected onUpdateRequest(msg: Message): void { + if (!this.closing) { + super.onUpdateRequest(msg); + } + } + protected onResize(msg: Widget.ResizeMessage): void { super.onResize(msg); this.widgetHeight = msg.height; @@ -195,7 +207,7 @@ export class SerialMonitorSendInput extends React.Component input.not-connected { - background-color: var(--theia-warn-color0); -} - .serial-monitor .head .config { display: flex; }