Skip to content

Commit 2046c0b

Browse files
committed
Continue monitoring with last connection if respective board is reconnected
Signed-off-by: jbicker <jan.bicker@typefox.io>
1 parent 3eebd58 commit 2046c0b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

arduino-ide-extension/src/browser/monitor/monitor-widget.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ export class MonitorWidget extends ReactWidget implements StatefulWidget {
131131

132132
protected widgetHeight: number;
133133

134+
protected continuePreviousConnection: boolean;
135+
134136
constructor(
135137
@inject(MonitorServiceClientImpl) protected readonly serviceClient: MonitorServiceClientImpl,
136138
@inject(MonitorConnection) protected readonly connection: MonitorConnection,
@@ -204,13 +206,18 @@ export class MonitorWidget extends ReactWidget implements StatefulWidget {
204206
}
205207
return false;
206208
});
207-
if (!connectedBoard) {
208-
this.close();
209+
if (connectedBoard && currentConnectionConfig) {
210+
this.continuePreviousConnection = true;
211+
this.connection.connect(currentConnectionConfig);
209212
}
210213
}));
211214

212215
this.toDisposeOnDetach.push(this.connection.onConnectionChanged(() => {
213-
this.clear();
216+
if (!this.continuePreviousConnection) {
217+
this.clear();
218+
} else {
219+
this.continuePreviousConnection = false;
220+
}
214221
}));
215222
}
216223

0 commit comments

Comments
 (0)