From d9696c98c35bcc87b3d5313de03db23b4c5b1ed7 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 24 Jul 2017 13:59:28 +0200 Subject: [PATCH] FIX: broken spec --- .../discourse/components/emoji-picker.js.es6 | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/discourse/components/emoji-picker.js.es6 b/app/assets/javascripts/discourse/components/emoji-picker.js.es6 index bd745becd65..f79a58669a0 100644 --- a/app/assets/javascripts/discourse/components/emoji-picker.js.es6 +++ b/app/assets/javascripts/discourse/components/emoji-picker.js.es6 @@ -18,7 +18,7 @@ export function resetCache() { keyValueStore.setObject({ key: EMOJI_SELECTED_DIVERSITY, value: 1 }); } -let $picker, $filter, $results, $list, scrollPosition, $visibleSections; +let $picker, $filter, $results, $list, scrollPosition, $visibleSections, _checkTimeout; export default Ember.Component.extend({ willDestroyElement() { @@ -119,7 +119,7 @@ export default Ember.Component.extend({ this._unbindEvents(); - this._unbindSectionLoadingCheck(); + clearTimeout(_checkTimeout); }, show() { @@ -137,23 +137,16 @@ export default Ember.Component.extend({ this._bindEvents(); Ember.run.scheduleOnce("afterRender", this, function() { + this._sectionLoadingCheck(); this._loadCategoriesEmojis(); this._positionPicker(); this._scrollTo(); - this._sectionLoadingCheck(); }); }, - _unbindSectionLoadingCheck() { - Ember.run.cancel(this.get("nextSectionloadingCheck")); - }, - _sectionLoadingCheck() { - const nextSectionloadingCheck = Ember.run.later(this, function() { - Ember.run.throttle(this, this._checkVisibleSection, 100); - this._sectionLoadingCheck(); - }, 500); - this.set("nextSectionloadingCheck", nextSectionloadingCheck); + _checkTimeout = setTimeout(() => { this._sectionLoadingCheck(); }, 500); + Ember.run.throttle(this, this._checkVisibleSection, 100); }, _loadCategoriesEmojis() {