From 0c9ea1aaf2cc809acd16da24f6a6e056ac5451e1 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 21 Jul 2017 11:46:34 +0200 Subject: [PATCH] reduce emoji loading threshold --- .../discourse/components/emoji-picker.js.es6 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/components/emoji-picker.js.es6 b/app/assets/javascripts/discourse/components/emoji-picker.js.es6 index feb18dc5a93..cf9c2d704b1 100644 --- a/app/assets/javascripts/discourse/components/emoji-picker.js.es6 +++ b/app/assets/javascripts/discourse/components/emoji-picker.js.es6 @@ -282,7 +282,7 @@ export default Ember.Component.extend({ _bindSectionsScroll() { $list.on("scroll", () => { - Ember.run.debounce(this, this._checkVisibleSection, 500); + Ember.run.debounce(this, this._checkVisibleSection, 150); Ember.run.debounce(this, this._storeScrollPosition, 100); }); }, @@ -334,7 +334,7 @@ export default Ember.Component.extend({ if(preloadedSection && !preloadedSection.$section.hasClass("loaded")) { preloadedSection.$section.addClass("loaded"); const $visibleEmojis = preloadedSection.$section.find(".emoji[src='']"); - Ember.run.later(this, () => this._loadVisibleEmojis($visibleEmojis), 3000); + Ember.run.later(this, () => this._loadVisibleEmojis($visibleEmojis), 1500); } } }, @@ -508,7 +508,12 @@ export default Ember.Component.extend({ $icon.parent().attr("title"), diversity || $icon.hasClass("diversity") ); - $icon.attr("src", ""); + + // force visual reloading if needed + if($icon.attr("src") !== "") { + $icon.attr("src", ""); + } + $icon.attr("src", emojiUrlFor(code)); }, });