From 049e225d0ac79e20f114c12cd1d0e8636b0e657c Mon Sep 17 00:00:00 2001 From: Georgi Prodanov Date: Tue, 7 Mar 2017 17:00:11 +0200 Subject: [PATCH] #329738 Fix multiple calls to fetching functions on groups screen. Remove padding from group tabs. --- app/groups/groups/groups.component.css | 2 +- app/groups/groups/groups.component.ts | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/groups/groups/groups.component.css b/app/groups/groups/groups.component.css index e56896c..beaf3fb 100644 --- a/app/groups/groups/groups.component.css +++ b/app/groups/groups/groups.component.css @@ -1,5 +1,5 @@ .tab-item { - padding: 10 0; + padding: 0 0; } .tab-items-wrapper.no-groups { diff --git a/app/groups/groups/groups.component.ts b/app/groups/groups/groups.component.ts index 0e35918..5e14329 100644 --- a/app/groups/groups/groups.component.ts +++ b/app/groups/groups/groups.component.ts @@ -85,7 +85,7 @@ export class GroupsComponent implements OnInit { if (!this.hasMoreUserGroups || this._lockUserGroups) { return Promise.resolve(); } - this._lockUserGroups = false; + this._lockUserGroups = true; return this._usersService.currentUser() .then((u) => this._groupsService.getUserGroups(u.Id, this._userGroupsPage, this._pageSize)) .then(groups => { @@ -94,15 +94,19 @@ export class GroupsComponent implements OnInit { if (this.hasMoreUserGroups) { this._userGroupsPage++; } + this._lockUserGroups = false; }) - .catch(err => this.hasMoreUserGroups = true); + .catch(err => { + this._lockUserGroups = false; + this.hasMoreUserGroups = true + }); } loadMoresUnjoinedGroups() { if (!this.hasMoreUnjoined || this._lockUnjoinedGroups) { return Promise.resolve(); } - this._lockUnjoinedGroups = false; + this._lockUnjoinedGroups = true; return this._usersService.currentUser() .then((u) => this._groupsService.getUnjoinedGroups(u.Id, this._unjoinedPage, this._pageSize)) .then(groups => { @@ -111,8 +115,12 @@ export class GroupsComponent implements OnInit { if (this.hasMoreUnjoined) { this._unjoinedPage++; } + this._lockUnjoinedGroups = false; }) - .catch(err => this.hasMoreUnjoined = true); + .catch(err => { + this._lockUnjoinedGroups = false; + this.hasMoreUnjoined = true; + }); } private _hasMore(receivedCount: number, pageSize: number) {