diff --git a/src/views/nodes/repositoriesNode.ts b/src/views/nodes/repositoriesNode.ts index 77db91a..d4ccb4b 100644 --- a/src/views/nodes/repositoriesNode.ts +++ b/src/views/nodes/repositoriesNode.ts @@ -168,6 +168,6 @@ export class RepositoriesNode extends SubscribeableViewNode { return this.workspace.name; } - private _children: ViewNode[] | undefined; + private _children: + | (CommandMessageNode | MessageNode | RepositoryNode | WorkspaceMissingRepositoryNode)[] + | undefined; async getChildren(): Promise { 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; } } diff --git a/src/views/nodes/workspacesViewNode.ts b/src/views/nodes/workspacesViewNode.ts index b8668ac..3bb0214 100644 --- a/src/views/nodes/workspacesViewNode.ts +++ b/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; } }