瀏覽代碼

Fixes node leaks from subscriptions

main
Eric Amodio 1 年之前
父節點
當前提交
84d1ede76c
共有 3 個檔案被更改,包括 24 行新增2 行删除
  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 查看文件

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

+ 13
- 1
src/views/nodes/workspaceNode.ts 查看文件

@ -30,7 +30,9 @@ export class WorkspaceNode extends ViewNode {
return this.workspace.name;
}
private _children: ViewNode[] | undefined;
private _children:
| (CommandMessageNode | MessageNode | RepositoryNode | WorkspaceMissingRepositoryNode)[]
| undefined;
async getChildren(): Promise<ViewNode[]> {
if (this._children == null) {
@ -130,6 +132,16 @@ export class WorkspaceNode extends ViewNode {
}
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;
}
}

+ 10
- 0
src/views/nodes/workspacesViewNode.ts 查看文件

@ -55,6 +55,16 @@ export class WorkspacesViewNode extends ViewNode {
@gate()
@debug()
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;
}
}

Loading…
取消
儲存