mirror of
https://github.com/discourse/discourse.git
synced 2025-02-14 07:14:55 +00:00
Previously we were loading almost all the data in an afterModel hook, storing it temporarily in route properties, and then passing it to the controller in `setupController`. This does not follow Ember best-practices, and causes a number of unexpected behaviours. For example, Ember only calls `setupController` **when the model value changes**. Since `model()` was only returning the tag, that meant that category changes and `additionalTag` changes wouldn't always trigger a `setupController` call, and things would get into a very weird state. This is visible when using the 'loading-slider' component because the category navigation dropdown gets 'stuck' when switching categories. This commit moves all the data-fetching into `model()`. To make things cleaner, it also: - removes most uses of route-level variables - introduces async/await in the model() function - removes some unneeded `get()` usage - re-uses DiscoverySortableController for queryParam default handling - Removes override of `renderTemplate()` so that queryParams are correctly passed through to the controller - Removes some `transitionToRoute` hacks which were working around the queryParams issue - Switches to `@action`