Browse Source

Fixes node leaks from subscriptions

main
Eric Amodio 1 year ago
parent
commit
84d1ede76c
3 changed files with 24 additions and 2 deletions
  1. +1
    -1
      src/views/nodes/repositoriesNode.ts
  2. +13
    -1
      src/views/nodes/workspaceNode.ts
  3. +10
    -0
      src/views/nodes/workspacesViewNode.ts

+ 1
- 1
src/views/nodes/repositoriesNode.ts View File

@ -168,6 +168,6 @@ export class RepositoriesNode extends SubscribeableViewNode
@debug() @debug()
private onRepositoriesChanged(_e: RepositoriesChangeEvent) { private onRepositoriesChanged(_e: RepositoriesChangeEvent) {
void this.triggerChange();
void this.triggerChange(true);
} }
} }

+ 13
- 1
src/views/nodes/workspaceNode.ts View File

@ -30,7 +30,9 @@ export class WorkspaceNode extends ViewNode {
return this.workspace.name; return this.workspace.name;
} }
private _children: ViewNode[] | undefined;
private _children:
| (CommandMessageNode | MessageNode | RepositoryNode | WorkspaceMissingRepositoryNode)[]
| undefined;
async getChildren(): Promise<ViewNode[]> { async getChildren(): Promise<ViewNode[]> {
if (this._children == null) { if (this._children == null) {
@ -130,6 +132,16 @@ export class WorkspaceNode extends ViewNode {
} }
override refresh() { override refresh() {
if (this._children == null) return;
if (this._children.length) {
for (const child of this._children) {
if ('dispose' in child) {
child.dispose();
}
}
}
this._children = undefined; this._children = undefined;
} }
} }

+ 10
- 0
src/views/nodes/workspacesViewNode.ts View File

@ -55,6 +55,16 @@ export class WorkspacesViewNode extends ViewNode {
@gate() @gate()
@debug() @debug()
override refresh() { override refresh() {
if (this._children == null) return;
if (this._children.length) {
for (const child of this._children) {
if ('dispose' in child) {
child.dispose();
}
}
}
this._children = undefined; this._children = undefined;
} }
} }

Loading…
Cancel
Save