Skip to content

Commit 44d3d67

Browse files
committed
Adds loading message to views
1 parent b91b7a9 commit 44d3d67

File tree

9 files changed

+29
-7
lines changed

9 files changed

+29
-7
lines changed

src/views/branchesView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ export class BranchesViewNode extends RepositoriesSubscribeableNode<BranchesView
5757
this.view.message = undefined;
5858

5959
if (this.children == null) {
60+
this.view.message = 'Loading branches...';
61+
6062
if (this.view.container.git.isDiscoveringRepositories) {
61-
this.view.message = 'Loading branches...';
6263
await this.view.container.git.isDiscoveringRepositories;
6364
}
6465

@@ -104,6 +105,7 @@ export class BranchesViewNode extends RepositoriesSubscribeableNode<BranchesView
104105
return [];
105106
}
106107

108+
queueMicrotask(() => (this.view.message = undefined));
107109
this.view.description = this.view.getViewDescription(branches.values.length);
108110

109111
return child.getChildren();

src/views/commitsView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ export class CommitsViewNode extends RepositoriesSubscribeableNode<CommitsView,
130130
this.view.message = undefined;
131131

132132
if (this.children == null) {
133+
this.view.message = 'Loading commits...';
134+
133135
if (this.view.container.git.isDiscoveringRepositories) {
134-
this.view.message = 'Loading commits...';
135136
await this.view.container.git.isDiscoveringRepositories;
136137
}
137138

@@ -200,6 +201,7 @@ export class CommitsViewNode extends RepositoriesSubscribeableNode<CommitsView,
200201
children.push(...this.children);
201202
}
202203

204+
queueMicrotask(() => (this.view.message = undefined));
203205
return children;
204206
}
205207

src/views/contributorsView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ export class ContributorsViewNode extends RepositoriesSubscribeableNode<Contribu
5858
this.view.message = undefined;
5959

6060
if (this.children == null) {
61+
this.view.message = 'Loading contributors...';
62+
6163
if (this.view.container.git.isDiscoveringRepositories) {
62-
this.view.message = 'Loading contributors...';
6364
await this.view.container.git.isDiscoveringRepositories;
6465
}
6566

@@ -109,6 +110,7 @@ export class ContributorsViewNode extends RepositoriesSubscribeableNode<Contribu
109110
return [];
110111
}
111112

113+
queueMicrotask(() => (this.view.message = undefined));
112114
this.view.description = this.view.getViewDescription(children.length);
113115

114116
return children;

src/views/draftsView.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export class DraftsViewNode extends CacheableChildrenViewNode<'drafts', DraftsVi
2727

2828
async getChildren(): Promise<(GroupingNode | DraftNode)[]> {
2929
if (this.children == null) {
30+
this.view.message = 'Loading Cloud Patches...';
31+
3032
const children: (GroupingNode | DraftNode)[] = [];
3133

3234
try {
@@ -57,6 +59,7 @@ export class DraftsViewNode extends CacheableChildrenViewNode<'drafts', DraftsVi
5759
if (!(ex instanceof AuthenticationRequiredError)) throw ex;
5860
}
5961

62+
queueMicrotask(() => (this.view.message = undefined));
6063
this.children = children;
6164
}
6265

src/views/remotesView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ export class RemotesViewNode extends RepositoriesSubscribeableNode<RemotesView,
5353
this.view.message = undefined;
5454

5555
if (this.children == null) {
56+
this.view.message = 'Loading remotes...';
57+
5658
if (this.view.container.git.isDiscoveringRepositories) {
57-
this.view.message = 'Loading remotes...';
5859
await this.view.container.git.isDiscoveringRepositories;
5960
}
6061

@@ -86,6 +87,7 @@ export class RemotesViewNode extends RepositoriesSubscribeableNode<RemotesView,
8687
return [];
8788
}
8889

90+
queueMicrotask(() => (this.view.message = undefined));
8991
this.view.description = this.view.getViewDescription(remotes.length);
9092

9193
return child.getChildren();

src/views/stashesView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ export class StashesViewNode extends RepositoriesSubscribeableNode<StashesView,
3939
this.view.message = undefined;
4040

4141
if (this.children == null) {
42+
this.view.message = 'Loading stashes...';
43+
4244
if (this.view.container.git.isDiscoveringRepositories) {
43-
this.view.message = 'Loading stashes...';
4445
await this.view.container.git.isDiscoveringRepositories;
4546
}
4647

@@ -72,6 +73,7 @@ export class StashesViewNode extends RepositoriesSubscribeableNode<StashesView,
7273
return [];
7374
}
7475

76+
queueMicrotask(() => (this.view.message = undefined));
7577
this.view.description = this.view.getViewDescription(gitStash.stashes.size);
7678

7779
return child.getChildren();

src/views/tagsView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ export class TagsViewNode extends RepositoriesSubscribeableNode<TagsView, TagsRe
4040
this.view.message = undefined;
4141

4242
if (this.children == null) {
43+
this.view.message = 'Loading tags...';
44+
4345
if (this.view.container.git.isDiscoveringRepositories) {
44-
this.view.message = 'Loading tags...';
4546
await this.view.container.git.isDiscoveringRepositories;
4647
}
4748

@@ -73,6 +74,7 @@ export class TagsViewNode extends RepositoriesSubscribeableNode<TagsView, TagsRe
7374
return [];
7475
}
7576

77+
queueMicrotask(() => (this.view.message = undefined));
7678
this.view.description = this.view.getViewDescription(tags.values.length);
7779

7880
return child.getChildren();

src/views/workspacesView.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ export class WorkspacesViewNode extends ViewNode<'workspaces', WorkspacesView> {
2929
private _children: (WorkspaceNode | MessageNode | RepositoriesNode)[] | undefined;
3030

3131
async getChildren(): Promise<ViewNode[]> {
32+
this.view.message = undefined;
33+
3234
if (this._children == null) {
35+
this.view.message = 'Loading Cloud Workspaces...';
36+
3337
const children: (WorkspaceNode | MessageNode | RepositoriesNode)[] = [];
3438

3539
const { cloudWorkspaces, cloudWorkspaceInfo, localWorkspaces, localWorkspaceInfo } =
@@ -59,6 +63,7 @@ export class WorkspacesViewNode extends ViewNode<'workspaces', WorkspacesView> {
5963
}
6064
}
6165

66+
queueMicrotask(() => (this.view.message = undefined));
6267
this._children = children;
6368
}
6469

src/views/worktreesView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ export class WorktreesViewNode extends RepositoriesSubscribeableNode<WorktreesVi
5252
this.view.message = undefined;
5353

5454
if (this.children == null) {
55+
this.view.message = 'Loading worktrees...';
56+
5557
const access = await this.view.container.git.access('worktrees');
5658
if (access.allowed === false) return [];
5759

5860
if (this.view.container.git.isDiscoveringRepositories) {
59-
this.view.message = 'Loading worktrees...';
6061
await this.view.container.git.isDiscoveringRepositories;
6162
}
6263

@@ -92,6 +93,7 @@ export class WorktreesViewNode extends RepositoriesSubscribeableNode<WorktreesVi
9293
return [];
9394
}
9495

96+
queueMicrotask(() => (this.view.message = undefined));
9597
this.view.description = this.view.getViewDescription(grandChildren.length);
9698

9799
return grandChildren;

0 commit comments

Comments
 (0)