Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 83980b3

Browse filesBrowse files
author
Akos Kitta
committed
fix: refresh the user-fields at app startup
Ref: #2165 Closes #2230 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 73ddbef commit 83980b3
Copy full SHA for 83980b3

File tree

Expand file treeCollapse file tree

1 file changed

+14
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-8
lines changed

‎arduino-ide-extension/src/browser/contributions/user-fields.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/contributions/user-fields.ts
+14-8Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { nls } from '@theia/core/lib/common/nls';
12
import { inject, injectable } from '@theia/core/shared/inversify';
2-
import { nls } from '@theia/core/lib/common';
33
import { BoardUserField, CoreError } from '../../common/protocol';
44
import { BoardsServiceProvider } from '../boards/boards-service-provider';
55
import { UserFieldsDialog } from '../dialogs/user-fields/user-fields-dialog';
66
import { ArduinoMenus } from '../menu/arduino-menus';
7-
import { MenuModelRegistry, Contribution } from './contribution';
7+
import { Contribution, MenuModelRegistry } from './contribution';
88
import { UploadSketch } from './upload-sketch';
99

1010
@injectable()
@@ -21,12 +21,11 @@ export class UserFields extends Contribution {
2121

2222
protected override init(): void {
2323
super.init();
24-
this.boardsServiceProvider.onBoardsConfigDidChange(async () => {
25-
const userFields =
26-
await this.boardsServiceProvider.selectedBoardUserFields();
27-
this.boardRequiresUserFields = userFields.length > 0;
28-
this.menuManager.update();
29-
});
24+
this.boardsServiceProvider.onBoardsConfigDidChange(() => this.refresh());
25+
}
26+
27+
override onReady(): void {
28+
this.boardsServiceProvider.ready.then(() => this.refresh());
3029
}
3130

3231
override registerMenus(registry: MenuModelRegistry): void {
@@ -37,6 +36,13 @@ export class UserFields extends Contribution {
3736
});
3837
}
3938

39+
private async refresh(): Promise<void> {
40+
const userFields =
41+
await this.boardsServiceProvider.selectedBoardUserFields();
42+
this.boardRequiresUserFields = userFields.length > 0;
43+
this.menuManager.update();
44+
}
45+
4046
private selectedFqbnAddress(): string | undefined {
4147
const { boardsConfig } = this.boardsServiceProvider;
4248
const fqbn = boardsConfig.selectedBoard?.fqbn;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.