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?
This commit is contained in:
parent
28e9f54e2f
commit
091d6dc9fc
|
@ -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");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue