FIX: When loading more topics, showFooter was not updated properly

This commit is contained in:
Robin Ward 2022-01-05 14:52:30 -05:00
parent e04069cf0d
commit 6e0e6014d1
3 changed files with 8 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import LoadMore from "discourse/mixins/load-more";
import UrlRefresh from "discourse/mixins/url-refresh";
import { inject as service } from "@ember/service";
const DiscoveryTopicsListComponent = Component.extend(UrlRefresh, LoadMore, {
export default Component.extend(UrlRefresh, LoadMore, {
classNames: ["contents"],
eyelineSelector: ".topic-list-item",
documentTitle: service(),
@ -60,9 +60,10 @@ const DiscoveryTopicsListComponent = Component.extend(UrlRefresh, LoadMore, {
if (moreTopicsUrl && $(window).height() >= $(document).height()) {
this.send("loadMore");
}
if (this.loadingComplete) {
this.loadingComplete();
}
});
},
},
});
export default DiscoveryTopicsListComponent;

View File

@ -1,5 +1,6 @@
import Controller, { inject as controller } from "@ember/controller";
import { alias, equal, not } from "@ember/object/computed";
import { action } from "@ember/object";
import Category from "discourse/models/category";
import DiscourseURL from "discourse/lib/url";
import { inject as service } from "@ember/service";
@ -20,11 +21,13 @@ export default Controller.extend({
loadedAllItems: not("discoveryTopics.model.canLoadMore"),
@action
loadingBegan() {
this.set("loading", true);
this.set("application.showFooter", false);
},
@action
loadingComplete() {
this.set("loading", false);
this.set("application.showFooter", this.loadedAllItems);

View File

@ -19,6 +19,7 @@ model=model showResetNew=showResetNew showDismissRead=showDismissRead resetNew=(
{{#discovery-topics-list
model=model
refresh=(action "refresh")
loadingComplete=(action "loadingComplete")
incomingCount=topicTrackingState.incomingCount
autoAddTopicsToBulkSelect=autoAddTopicsToBulkSelect
bulkSelectEnabled=bulkSelectEnabled