mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
FIX: Refresh logic in discovery topic lists (#15489)
Before6e0e6014
, the flow looked something like: 1. `discovery/topics` controller (which extends `discovery` controller) `afterRefresh()` calls `.send("loadingComplete")` 2. Bubbles to [`discovery` route](554ff07786/app/assets/javascripts/discourse/app/routes/discovery.js (L58)
) 3. Discovery route calls `controllerFor('discovery').loadingComplete()`. `loading` is set false, and the spinner disappears Now that `discovery/topics` defines `loadingComplete` as an action, the `discovery/topics` controller runs its own `loadingComplete` handler logic in step 1, and the action does not bubble any further. This commit adds action overrides in `discovery/topics`, so that the new actions only apply to the main `discovery` controller. The need for this does suggest some more radical refactoring is required, but these are very critical routes, and we are very close to a major release.
This commit is contained in:
parent
554ff07786
commit
f94c01b233
@ -11,6 +11,7 @@ import { endWith } from "discourse/lib/computed";
|
||||
import { routeAction } from "discourse/helpers/route-action";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
const controllerOpts = {
|
||||
discovery: controller(),
|
||||
@ -32,6 +33,18 @@ const controllerOpts = {
|
||||
|
||||
selected: null,
|
||||
|
||||
// Remove these actions which are defined in `DiscoveryController`
|
||||
// We want them to bubble in DiscoveryTopicsController
|
||||
@action
|
||||
loadingBegan() {
|
||||
return true;
|
||||
},
|
||||
|
||||
@action
|
||||
loadingComplete() {
|
||||
return true;
|
||||
},
|
||||
|
||||
@discourseComputed("model.filter", "model.topics.length")
|
||||
showDismissRead(filter, topicsLength) {
|
||||
return this._isFilterPage(filter, "unread") && topicsLength > 0;
|
||||
|
Loading…
Reference in New Issue
Block a user