From 0bec73ad8ae50323bd14f2793806c997c893b7ef Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 18 Jul 2018 01:44:29 -0400 Subject: [PATCH] Fixes #252 - this.children reset because of await --- CHANGELOG.md | 1 + src/views/nodes/statusNode.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a5929..8ee1768 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed - Fixes [#444](https://github.com/eamodio/vscode-gitlens/issues/444) - GitLens custom viewlet icon slightly larger than standard - Fixes [#437](https://github.com/eamodio/vscode-gitlens/issues/437) - Remove --first-parent from git commands to show file history from merged in repositories +- Fixes [#252](https://github.com/eamodio/vscode-gitlens/issues/252) - Cannot read property 'push' of undefined - Fixes issue where GitLens saves a couple settings with default values into user settings (rather than just removing the setting) ## [8.5.0] - 2018-07-16 diff --git a/src/views/nodes/statusNode.ts b/src/views/nodes/statusNode.ts index 26c58bb..3f578d4 100644 --- a/src/views/nodes/statusNode.ts +++ b/src/views/nodes/statusNode.ts @@ -25,21 +25,21 @@ export class StatusNode extends ExplorerNode { async getChildren(): Promise { this.resetChildren(); - this.children = []; + const children = []; const status = await this.repo.getStatus(); if (status !== undefined) { if (status.state.behind) { - this.children.push(new StatusUpstreamNode(status, 'behind', this.explorer, this.active)); + children.push(new StatusUpstreamNode(status, 'behind', this.explorer, this.active)); } if (status.state.ahead) { - this.children.push(new StatusUpstreamNode(status, 'ahead', this.explorer, this.active)); + children.push(new StatusUpstreamNode(status, 'ahead', this.explorer, this.active)); } if (status.state.ahead || (status.files.length !== 0 && this.includeWorkingTree)) { const range = status.upstream ? `${status.upstream}..${status.branch}` : undefined; - this.children.push(new StatusFilesNode(status, range, this.explorer, this.active)); + children.push(new StatusFilesNode(status, range, this.explorer, this.active)); } } @@ -57,9 +57,10 @@ export class StatusNode extends ExplorerNode { ); } - this.children.push(new StatusBranchNode(branch, this.uri, this.explorer)); + children.push(new StatusBranchNode(branch, this.uri, this.explorer)); } + this.children = children; return this.children; }