DEV: removes setInterval as it might cause issues (#9722)

DEV: removes setInterval as it might cause issues (#9722)

diff --git a/app/assets/javascripts/discourse/app/components/emoji-picker.js b/app/assets/javascripts/discourse/app/components/emoji-picker.js
index bafd592..a77b564 100644
--- a/app/assets/javascripts/discourse/app/components/emoji-picker.js
+++ b/app/assets/javascripts/discourse/app/components/emoji-picker.js
@@ -1,5 +1,5 @@
 import { inject as service } from "@ember/service";
-import { throttle, debounce, schedule } from "@ember/runloop";
+import { throttle, debounce, schedule, later } from "@ember/runloop";
 import Component from "@ember/component";
 import { on, observes } from "discourse-common/utils/decorators";
 import { findRawTemplate } from "discourse-common/lib/raw-templates";
@@ -196,6 +196,8 @@ export default Component.extend({
     if (!this.site.isMobileDevice) {
       this._bindHover();
     }
+
+    later(this, this._onScroll, 100);
   },
 
   _bindModalClick() {
@@ -221,7 +223,6 @@ export default Component.extend({
   _unbindEvents() {
     $(this.element).off();
     $(window).off("resize");
-    clearInterval(this._refreshInterval);
     $("#reply-control").off("div-resizing");
     $("html").off("mouseup.emoji-picker");
   },
@@ -370,12 +371,11 @@ export default Component.extend({
   },
 
   _bindSectionsScroll() {
-    let onScroll = () => {
-      debounce(this, this._checkVisibleSection, 50);
-    };
+    this.$list.on("scroll", this._onScroll.bind(this));
+  },
 
-    this.$list.on("scroll", onScroll);
-    this._refreshInterval = setInterval(onScroll, 100);
+  _onScroll() {
+    debounce(this, this._checkVisibleSection, 50);
   },
 
   _checkVisibleSection(force) {
@@ -420,6 +420,8 @@ export default Component.extend({
 
       this._loadVisibleSections();
     }
+
+    later(this, this._checkVisibleSection, 100);
   },
 
   _loadVisibleSections() {

GitHub sha: 3b2b635e

This commit appears in #9722 which was merged by jjaffeux.