From 7ab153dac3c7111451d186486964dab9d7e5855f Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 29 Mar 2016 16:56:29 +1100 Subject: [PATCH] FIX: double XHR request when loading more badges --- .../javascripts/discourse/controllers/badges/show.js.es6 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 index 714635f6030..5df73481acd 100644 --- a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 @@ -21,6 +21,11 @@ export default Ember.Controller.extend({ actions: { loadMore() { + if (this.get('loadingMore')) { + return; + } + this.set('loadingMore', true); + const userBadges = this.get('userBadges'); UserBadge.findByBadgeId(this.get('model.id'), { @@ -31,6 +36,8 @@ export default Ember.Controller.extend({ if (userBadges.length === 0){ this.set('noMoreBadges', true); } + }).finally(()=>{ + this.set('loadingMore', false); }); } },