Browse Source

Fixes refresh issue when going from none to some

main
Eric Amodio 4 years ago
parent
commit
316590e3fe
7 changed files with 21 additions and 5 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +3
    -0
      src/views/branchesView.ts
  3. +3
    -0
      src/views/contributorsView.ts
  4. +5
    -5
      src/views/nodes/viewNode.ts
  5. +3
    -0
      src/views/remotesView.ts
  6. +3
    -0
      src/views/stashesView.ts
  7. +3
    -0
      src/views/tagsView.ts

+ 1
- 0
CHANGELOG.md View File

@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes [#1308](https://github.com/eamodio/vscode-gitlens/issues/1308) - Escape quotes for PRs titles
- Fixes [#1309](https://github.com/eamodio/vscode-gitlens/issues/1309) - "Fetch" not working on remote branches
- Fixes an issue where many views wouldn't refresh properly when going from no items to some items
## [11.1.3] - 2021-01-05

+ 3
- 0
src/views/branchesView.ts View File

@ -88,6 +88,9 @@ export class BranchesViewNode extends ViewNode {
const branches = await child.repo.getBranches({ filter: b => !b.remote });
if (branches.length === 0) {
this.view.message = 'No branches could be found.';
this.view.title = 'Branches';
void child.ensureSubscription();
return [];
}

+ 3
- 0
src/views/contributorsView.ts View File

@ -67,6 +67,9 @@ export class ContributorsViewNode extends ViewNode {
const contributors = await child.repo.getContributors();
if (contributors.length === 0) {
this.view.message = 'No contributors could be found.';
this.view.title = 'Contributors';
void child.ensureSubscription();
return [];
}

+ 5
- 5
src/views/nodes/viewNode.ts View File

@ -176,7 +176,7 @@ export abstract class SubscribeableViewNode extends V
protected disposable: Disposable;
protected subscription: Promise<Disposable | undefined> | undefined;
private _loaded: boolean = false;
protected loaded: boolean = false;
constructor(uri: GitUri, view: TView, parent?: ViewNode) {
super(uri, view, parent);
@ -192,14 +192,14 @@ export abstract class SubscribeableViewNode extends V
const getTreeItem = this.getTreeItem;
this.getTreeItem = function (this: SubscribeableViewNode<TView>) {
this._loaded = true;
this.loaded = true;
void this.ensureSubscription();
return getTreeItem.apply(this);
};
const getChildren = this.getChildren;
this.getChildren = function (this: SubscribeableViewNode<TView>) {
this._loaded = true;
this.loaded = true;
void this.ensureSubscription();
return getChildren.apply(this);
};
@ -217,7 +217,7 @@ export abstract class SubscribeableViewNode extends V
@gate()
@debug()
async triggerChange(reset: boolean = false, force: boolean = false): Promise<void> {
if (!this._loaded) return;
if (!this.loaded) return;
await super.triggerChange(reset, force);
}
@ -423,7 +423,7 @@ export abstract class RepositoryFolderNode<
}
if (this.changed(e)) {
void this.triggerChange(true);
void (this.loaded ? this : this.parent ?? this).triggerChange(true);
}
}
}

+ 3
- 0
src/views/remotesView.ts View File

@ -83,6 +83,9 @@ export class RemotesViewNode extends ViewNode {
const remotes = await child.repo.getRemotes();
if (remotes.length === 0) {
this.view.message = 'No remotes could be found.';
this.view.title = 'Remotes';
void child.ensureSubscription();
return [];
}

+ 3
- 0
src/views/stashesView.ts View File

@ -65,6 +65,9 @@ export class StashesViewNode extends ViewNode {
const stash = await child.repo.getStash();
if (stash == null) {
this.view.message = 'No stashes could be found.';
this.view.title = 'Stashes';
void child.ensureSubscription();
return [];
}

+ 3
- 0
src/views/tagsView.ts View File

@ -66,6 +66,9 @@ export class TagsViewNode extends ViewNode {
const tags = await child.repo.getTags();
if (tags.length === 0) {
this.view.message = 'No tags could be found.';
this.view.title = 'Tags';
void child.ensureSubscription();
return [];
}

||||||
x
 
000:0
Loading…
Cancel
Save