Skip to content

Commit 84d1ede

Browse files
committed
Fixes node leaks from subscriptions
1 parent 2835301 commit 84d1ede

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/views/nodes/repositoriesNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,6 @@ export class RepositoriesNode extends SubscribeableViewNode<ViewsWithRepositorie
168168

169169
@debug()
170170
private onRepositoriesChanged(_e: RepositoriesChangeEvent) {
171-
void this.triggerChange();
171+
void this.triggerChange(true);
172172
}
173173
}

src/views/nodes/workspaceNode.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export class WorkspaceNode extends ViewNode<WorkspacesView> {
3030
return this.workspace.name;
3131
}
3232

33-
private _children: ViewNode[] | undefined;
33+
private _children:
34+
| (CommandMessageNode | MessageNode | RepositoryNode | WorkspaceMissingRepositoryNode)[]
35+
| undefined;
3436

3537
async getChildren(): Promise<ViewNode[]> {
3638
if (this._children == null) {
@@ -130,6 +132,16 @@ export class WorkspaceNode extends ViewNode<WorkspacesView> {
130132
}
131133

132134
override refresh() {
135+
if (this._children == null) return;
136+
137+
if (this._children.length) {
138+
for (const child of this._children) {
139+
if ('dispose' in child) {
140+
child.dispose();
141+
}
142+
}
143+
}
144+
133145
this._children = undefined;
134146
}
135147
}

src/views/nodes/workspacesViewNode.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ export class WorkspacesViewNode extends ViewNode<WorkspacesView> {
5555
@gate()
5656
@debug()
5757
override refresh() {
58+
if (this._children == null) return;
59+
60+
if (this._children.length) {
61+
for (const child of this._children) {
62+
if ('dispose' in child) {
63+
child.dispose();
64+
}
65+
}
66+
}
67+
5868
this._children = undefined;
5969
}
6070
}

0 commit comments

Comments
 (0)