From 283530122fdd6258a5e7b6e3ddd303b0960cc791 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 12 Jul 2023 17:14:45 -0400 Subject: [PATCH] Fixes repo closed/opened eventing --- src/git/gitProviderService.ts | 5 +++++ src/git/models/repository.ts | 3 ++- src/views/nodes/repositoryNode.ts | 1 + src/views/nodes/viewNode.ts | 5 ++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index ef9f6f0..fc8eedf 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -440,6 +440,11 @@ export class GitProviderService implements Disposable { // Send a notification that the repositories changed queueMicrotask(() => this.fireRepositoriesChanged([], [e.repository])); + } else if (e.changed(RepositoryChange.Opened, RepositoryChangeComparisonMode.Any)) { + this.updateContext(); + + // Send a notification that the repositories changed + queueMicrotask(() => this.fireRepositoriesChanged([e.repository], [])); } if (e.changed(RepositoryChange.Remotes, RepositoryChangeComparisonMode.Any)) { diff --git a/src/git/models/repository.ts b/src/git/models/repository.ts index ebacd42..98a9898 100644 --- a/src/git/models/repository.ts +++ b/src/git/models/repository.ts @@ -81,6 +81,7 @@ export const enum RepositoryChange { Ignores = 101, RemoteProviders = 102, Starred = 103, + Opened = 104, } export const enum RepositoryChangeComparisonMode { @@ -459,7 +460,7 @@ export class Repository implements Disposable { const changed = this._closed !== value; this._closed = value; if (changed) { - this.fireChange(RepositoryChange.Closed); + this.fireChange(this._closed ? RepositoryChange.Closed : RepositoryChange.Opened); } } diff --git a/src/views/nodes/repositoryNode.ts b/src/views/nodes/repositoryNode.ts index 65dbcf2..19100a2 100644 --- a/src/views/nodes/repositoryNode.ts +++ b/src/views/nodes/repositoryNode.ts @@ -459,6 +459,7 @@ export class RepositoryNode extends SubscribeableViewNode RepositoryChange.Config, RepositoryChange.Index, RepositoryChange.Heads, + RepositoryChange.Opened, RepositoryChange.Status, RepositoryChange.Unknown, RepositoryChangeComparisonMode.Any, diff --git a/src/views/nodes/viewNode.ts b/src/views/nodes/viewNode.ts index a4313e1..ca36a4f 100644 --- a/src/views/nodes/viewNode.ts +++ b/src/views/nodes/viewNode.ts @@ -677,7 +677,10 @@ export abstract class RepositoryFolderNode< return; } - if (e.changed(RepositoryChange.Starred, RepositoryChangeComparisonMode.Any)) { + if ( + e.changed(RepositoryChange.Opened, RepositoryChangeComparisonMode.Any) || + e.changed(RepositoryChange.Starred, RepositoryChangeComparisonMode.Any) + ) { void this.parent?.triggerChange(true); return;