File tree 3 files changed +12
-3
lines changed
arduino-ide-extension/src
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,10 @@ export class MonitorManagerProxyClientImpl
58
58
* @param addressPort port of the WebSocket
59
59
*/
60
60
async connect ( addressPort : number ) : Promise < void > {
61
- if ( ! ! this . webSocket && this . wsPort === addressPort ) return ;
61
+ if ( ! ! this . webSocket ) {
62
+ if ( this . wsPort === addressPort ) return ;
63
+ else this . disconnect ( ) ;
64
+ }
62
65
try {
63
66
this . webSocket = new WebSocket ( `ws://localhost:${ addressPort } ` ) ;
64
67
} catch {
@@ -84,6 +87,7 @@ export class MonitorManagerProxyClientImpl
84
87
* Disconnects the WebSocket if connected.
85
88
*/
86
89
disconnect ( ) : void {
90
+ if ( ! this . webSocket ) return ;
87
91
try {
88
92
this . webSocket ?. close ( ) ;
89
93
this . webSocket = undefined ;
Original file line number Diff line number Diff line change @@ -137,8 +137,10 @@ export class MonitorViewContribution
137
137
138
138
protected async reset ( ) : Promise < void > {
139
139
const widget = this . tryGetWidget ( ) ;
140
- if ( widget ) widget . dispose ( ) ;
141
- await this . openView ( { activate : true , reveal : true } ) ;
140
+ if ( widget ) {
141
+ widget . dispose ( ) ;
142
+ await this . openView ( { activate : true , reveal : true } ) ;
143
+ }
142
144
}
143
145
144
146
protected renderAutoScrollButton ( ) : React . ReactNode {
Original file line number Diff line number Diff line change @@ -75,7 +75,9 @@ export class MonitorService extends CoreClientAware implements Disposable {
75
75
// data from this monitor, we can freely close
76
76
// and dispose it.
77
77
this . dispose ( ) ;
78
+ return ;
78
79
}
80
+ this . updateClientsSettings ( this . settings ) ;
79
81
} ) ;
80
82
81
83
this . portMonitorSettings ( port . protocol , board . fqbn ! ) . then (
@@ -447,6 +449,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
447
449
}
448
450
449
451
updateClientsSettings ( settings : MonitorSettings ) : void {
452
+ this . settings = { ...this . settings , ...settings } ;
450
453
const command : Monitor . Message = {
451
454
command : Monitor . MiddlewareCommand . ON_SETTINGS_DID_CHANGE ,
452
455
data : settings ,
You can’t perform that action at this time.
0 commit comments