8000 load the list widget content only when activated. · arduino/arduino-ide@5cecaab · GitHub
[go: up one dir, main page]

Skip to content

Commit 5cecaab

Browse files
author
Akos Kitta
committed
load the list widget content only when activated.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent ba1ff1a commit 5cecaab

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

arduino-ide-extension/src/browser/widgets/component-list/list-widget.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ export abstract class ListWidget<
4242
protected readonly filterTextChangeEmitter = new Emitter<
4343
string | undefined
4444
>();
45+
/**
46+
* Instead of running an `update` from the `postConstruct` `init` method,
47+
* we use this variable to track first activate, then run.
48+
*/
49+
protected firstActivate = true;
4550

4651
constructor(protected options: ListWidget.Options<T>) {
4752
super();
@@ -61,7 +66,6 @@ export abstract class ListWidget<
6166

6267
@postConstruct()
6368
protected init(): void {
64-
this.update();
6569
this.toDispose.pushAll([
6670
this.notificationCenter.onIndexUpdated(() => this.refresh(undefined)),
6771
this.notificationCenter.onDaemonStarted(() => this.refresh(undefined)),
@@ -74,6 +78,10 @@ export abstract class ListWidget<
7478
}
7579

7680
protected override onActivateRequest(message: Message): void {
81+
if (this.firstActivate) {
82+
this.firstActivate = false;
83+
this.update();
84+
}
7785
super.onActivateRequest(message);
7886
(this.focusNode || this.node).focus();
7987
}

0 commit comments

Comments
 (0)
0