Skip to content

Commit 2835301

Browse files
committed
Fixes repo closed/opened eventing
1 parent d0c2617 commit 2835301

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

src/git/gitProviderService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ export class GitProviderService implements Disposable {
440440

441441
// Send a notification that the repositories changed
442442
queueMicrotask(() => this.fireRepositoriesChanged([], [e.repository]));
443+
} else if (e.changed(RepositoryChange.Opened, RepositoryChangeComparisonMode.Any)) {
444+
this.updateContext();
445+
446+
// Send a notification that the repositories changed
447+
queueMicrotask(() => this.fireRepositoriesChanged([e.repository], []));
443448
}
444449

445450
if (e.changed(RepositoryChange.Remotes, RepositoryChangeComparisonMode.Any)) {

src/git/models/repository.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export const enum RepositoryChange {
8181
Ignores = 101,
8282
RemoteProviders = 102,
8383
Starred = 103,
84+
Opened = 104,
8485
}
8586

8687
export const enum RepositoryChangeComparisonMode {
@@ -459,7 +460,7 @@ export class Repository implements Disposable {
459460
const changed = this._closed !== value;
460461
this._closed = value;
461462
if (changed) {
462-
this.fireChange(RepositoryChange.Closed);
463+
this.fireChange(this._closed ? RepositoryChange.Closed : RepositoryChange.Opened);
463464
}
464465
}
465466

src/views/nodes/repositoryNode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ export class RepositoryNode extends SubscribeableViewNode<ViewsWithRepositories>
459459
RepositoryChange.Config,
460460
RepositoryChange.Index,
461461
RepositoryChange.Heads,
462+
RepositoryChange.Opened,
462463
RepositoryChange.Status,
463464
RepositoryChange.Unknown,
464465
RepositoryChangeComparisonMode.Any,

src/views/nodes/viewNode.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,10 @@ export abstract class RepositoryFolderNode<
677677
return;
678678
}
679679

680-
if (e.changed(RepositoryChange.Starred, RepositoryChangeComparisonMode.Any)) {
680+
if (
681+
e.changed(RepositoryChange.Opened, RepositoryChangeComparisonMode.Any) ||
682+
e.changed(RepositoryChange.Starred, RepositoryChangeComparisonMode.Any)
683+
) {
681684
void this.parent?.triggerChange(true);
682685

683686
return;

0 commit comments

Comments
 (0)