Skip to content

Commit 0bec73a

Browse files
committed
Fixes #252 - this.children reset because of await
1 parent 86f4a42 commit 0bec73a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1313
### Fixed
1414
- Fixes [#444](https://github.com/eamodio/vscode-gitlens/issues/444) - GitLens custom viewlet icon slightly larger than standard
1515
- Fixes [#437](https://github.com/eamodio/vscode-gitlens/issues/437) - Remove --first-parent from git commands to show file history from merged in repositories
16+
- Fixes [#252](https://github.com/eamodio/vscode-gitlens/issues/252) - Cannot read property 'push' of undefined
1617
- Fixes issue where GitLens saves a couple settings with default values into user settings (rather than just removing the setting)
1718

1819
## [8.5.0] - 2018-07-16

src/views/nodes/statusNode.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ export class StatusNode extends ExplorerNode {
2525
async getChildren(): Promise<ExplorerNode[]> {
2626
this.resetChildren();
2727

28-
this.children = [];
28+
const children = [];
2929

3030
const status = await this.repo.getStatus();
3131
if (status !== undefined) {
3232
if (status.state.behind) {
33-
this.children.push(new StatusUpstreamNode(status, 'behind', this.explorer, this.active));
33+
children.push(new StatusUpstreamNode(status, 'behind', this.explorer, this.active));
3434
}
3535

3636
if (status.state.ahead) {
37-
this.children.push(new StatusUpstreamNode(status, 'ahead', this.explorer, this.active));
37+
children.push(new StatusUpstreamNode(status, 'ahead', this.explorer, this.active));
3838
}
3939

4040
if (status.state.ahead || (status.files.length !== 0 && this.includeWorkingTree)) {
4141
const range = status.upstream ? `${status.upstream}..${status.branch}` : undefined;
42-
this.children.push(new StatusFilesNode(status, range, this.explorer, this.active));
42+
children.push(new StatusFilesNode(status, range, this.explorer, this.active));
4343
}
4444
}
4545

@@ -57,9 +57,10 @@ export class StatusNode extends ExplorerNode {
5757
);
5858
}
5959

60-
this.children.push(new StatusBranchNode(branch, this.uri, this.explorer));
60+
children.push(new StatusBranchNode(branch, this.uri, this.explorer));
6161
}
6262

63+
this.children = children;
6364
return this.children;
6465
}
6566

0 commit comments

Comments
 (0)