Skip to content

Commit 4967dfe

Browse files
Makes Launchpad View responsive to launchpad provider changes
1 parent 14b115a commit 4967dfe

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/views/launchpadView.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { ContextValues, getViewNodeId } from './nodes/abstract/viewNode';
2222
import type { GroupingNode } from './nodes/groupingNode';
2323
import { LaunchpadViewGroupingNode } from './nodes/launchpadViewGroupingNode';
2424
import { getPullRequestChildren, getPullRequestTooltip } from './nodes/pullRequestNode';
25-
import { ViewBase } from './viewBase';
25+
import { disposeChildren, ViewBase } from './viewBase';
2626
import { registerViewCommand } from './viewCommands';
2727

2828
export class LaunchpadItemNode extends CacheableChildrenViewNode<'launchpad-item', LaunchpadView> {
@@ -121,8 +121,23 @@ export class LaunchpadViewNode extends CacheableChildrenViewNode<
121121
LaunchpadView,
122122
GroupingNode | LaunchpadItemNode
123123
> {
124+
private disposable: Disposable;
125+
124126
constructor(view: LaunchpadView) {
125127
super('launchpad', unknownGitUri, view);
128+
this.disposable = Disposable.from(this.view.container.launchpad.onDidChange(this.refresh, this));
129+
}
130+
131+
override dispose() {
132+
this.disposable?.dispose();
133+
super.dispose();
134+
}
135+
136+
override refresh() {
137+
if (this.children == null) return;
138+
139+
disposeChildren(this.children);
140+
this.children = undefined;
126141
}
127142

128143
async getChildren(): Promise<(GroupingNode | LaunchpadItemNode)[]> {

0 commit comments

Comments
 (0)