DEV: Triggering "saw" on every element seems pointless

DEV: Triggering “saw” on every element seems pointless

We don’t seem to wire this up to any listeners, so why waste time doing all this work?

diff --git a/app/assets/javascripts/discourse/components/discovery-topics-list.js b/app/assets/javascripts/discourse/components/discovery-topics-list.js
index 30a0118..28ab1ef 100644
--- a/app/assets/javascripts/discourse/components/discovery-topics-list.js
+++ b/app/assets/javascripts/discourse/components/discovery-topics-list.js
@@ -38,9 +38,7 @@ const DiscoveryTopicsListComponent = Component.extend(UrlRefresh, LoadMore, {
       Discourse.updateContextCount(0);
       this.model.loadMore().then(hasMoreResults => {
         schedule("afterRender", () => this.saveScrollPosition());
-        if (!hasMoreResults) {
-          this.eyeline.flushRest();
-        } else if ($(window).height() >= $(document).height()) {
+        if (hasMoreResults && $(window).height() >= $(document).height()) {
           this.send("loadMore");
         }
       });
diff --git a/app/assets/javascripts/discourse/components/user-stream.js b/app/assets/javascripts/discourse/components/user-stream.js
index 62d9fe7..aadd188 100644
--- a/app/assets/javascripts/discourse/components/user-stream.js
+++ b/app/assets/javascripts/discourse/components/user-stream.js
@@ -110,10 +110,7 @@ export default Component.extend(LoadMore, {
 
       this.set("loading", true);
       const stream = this.stream;
-      stream.findItems().then(() => {
-        this.set("loading", false);
-        this.eyeline.flushRest();
-      });
+      stream.findItems().then(() => this.set("loading", false));
     }
   }
 });
diff --git a/app/assets/javascripts/discourse/lib/eyeline.js b/app/assets/javascripts/discourse/lib/eyeline.js
index d31602e..53f2a84 100644
--- a/app/assets/javascripts/discourse/lib/eyeline.js
+++ b/app/assets/javascripts/discourse/lib/eyeline.js
@@ -78,7 +78,6 @@ Eyeline.prototype.update = function() {
 
     // If you hit the bottom we mark all the elements as seen. Otherwise, just the first one
     if (!atBottom) {
-      appEvents.trigger("saw", { detail: $elem });
       return false;
     }
     if (i === $elements.length - 1) {
@@ -87,15 +86,4 @@ Eyeline.prototype.update = function() {
   });
 };
 
-//  Call this when we know aren't loading any more elements. Mark the rest as seen
-Eyeline.prototype.flushRest = function() {
-  if (ENV.environment === "test") {
-    return;
-  }
-
-  $(this.selector).each((i, elem) =>
-    this.appEvents.trigger("saw", { detail: $(elem) })
-  );
-};
-
 export default Eyeline;

GitHub sha: 091d6dc9