Skip to content

Commit 00e7bf7

Browse files
author
Akos Kitta
committed
disabled "trick" for deferring menu update.
Signed-off-by: Akos Kitta <[email protected]>
1 parent 1553d4d commit 00e7bf7

File tree

4 files changed

+30
-22
lines changed

4 files changed

+30
-22
lines changed

Diff for: arduino-ide-extension/src/browser/boards/boards-data-menu-updater.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { BoardsDataStore } from './boards-data-store';
1313
import { MainMenuManager } from '../../common/main-menu-manager';
1414
import { ArduinoMenus, unregisterSubmenu } from '../menu/arduino-menus';
1515
import { nls } from '@theia/core/lib/common';
16+
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
1617

1718
@injectable()
1819
export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
@@ -31,11 +32,20 @@ export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
3132
@inject(BoardsServiceProvider)
3233
protected readonly boardsServiceClient: BoardsServiceProvider;
3334

35+
@inject(FrontendApplicationStateService)
36+
private readonly appStateService: FrontendApplicationStateService;
37+
3438
protected readonly queue = new PQueue({ autoStart: true, concurrency: 1 });
3539
protected readonly toDisposeOnBoardChange = new DisposableCollection();
3640

3741
async onStart(): Promise<void> {
38-
this.updateMenuActions(this.boardsServiceClient.boardsConfig.selectedBoard);
42+
this.appStateService
43+
.reachedState('ready')
44+
.then(() =>
45+
this.updateMenuActions(
46+
this.boardsServiceClient.boardsConfig.selectedBoard
47+
)
48+
);
3949
this.boardsDataStore.onChanged(() =>
4050
this.updateMenuActions(
4151
this.boardsServiceClient.boardsConfig.selectedBoard

Diff for: arduino-ide-extension/src/browser/contributions/board-selection.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,14 @@ PID: ${PID}`;
101101
}
102102

103103
override onStart(): void {
104-
this.notificationCenter.onPlatformInstalled(this.updateMenus.bind(this));
105-
this.notificationCenter.onPlatformUninstalled(this.updateMenus.bind(this));
106-
this.boardsServiceProvider.onBoardsConfigChanged(
107-
this.updateMenus.bind(this)
104+
this.notificationCenter.onPlatformInstalled(() => this.updateMenus());
105+
this.notificationCenter.onPlatformUninstalled(() => this.updateMenus());
106+
this.boardsServiceProvider.onBoardsConfigChanged(() => this.updateMenus());
107+
this.boardsServiceProvider.onAvailableBoardsChanged(() =>
108+
this.updateMenus()
108109
);
109-
this.boardsServiceProvider.onAvailableBoardsChanged(
110-
this.updateMenus.bind(this)
111-
);
112-
this.boardsServiceProvider.onAvailablePortsChanged(
113-
this.updateMenus.bind(this)
110+
this.boardsServiceProvider.onAvailablePortsChanged(() =>
111+
this.updateMenus()
114112
);
115113
}
116114

Diff for: arduino-ide-extension/src/electron-browser/theia/core/electron-menu-contribution.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ export class ElectronMenuContribution
1818
@inject(FrontendApplicationStateService)
1919
private readonly appStateService: FrontendApplicationStateService;
2020

21-
private appReady = false;
22-
private updateWhenReady = false;
21+
// private appReady = false;
22+
// private updateWhenReady = false;
2323

2424
override onStart(app: FrontendApplication): void {
2525
super.onStart(app);
2626
this.appStateService.reachedState('ready').then(() => {
27-
this.appReady = true;
28-
if (this.updateWhenReady) {
29-
this.update();
30-
}
27+
// this.appReady = true;
28+
// if (this.updateWhenReady) {
29+
// this.update();
30+
// }
3131
});
3232
}
3333

@@ -37,11 +37,11 @@ export class ElectronMenuContribution
3737
}
3838

3939
update(): void {
40-
if (this.appReady) {
41-
(this as any).setMenu();
42-
} else {
43-
this.updateWhenReady = true;
44-
}
40+
(this as any).setMenu();
41+
// if (this.appReady) {
42+
// } else {
43+
// this.updateWhenReady = true;
44+
// }
4545
}
4646

4747
override registerCommands(registry: CommandRegistry): void {

Diff for: arduino-ide-extension/src/node/arduino-daemon-impl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class ArduinoDaemonImpl
4141
// Backend application lifecycle.
4242

4343
onStart(): void {
44-
this.startDaemon();
44+
this.startDaemon(); // no await
4545
}
4646

4747
// Daemon API

0 commit comments

Comments
 (0)