From 7caa28cf4555ba83abbf611b3f79a9e3248433af Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 25 Jan 2019 16:48:20 +0100 Subject: [PATCH] FIX: ensures ordering set in tags-show queryString works at first load (#6951) --- app/assets/javascripts/discourse/routes/tags-show.js.es6 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/routes/tags-show.js.es6 b/app/assets/javascripts/discourse/routes/tags-show.js.es6 index 72a02c2ed51..c4d7edd2447 100644 --- a/app/assets/javascripts/discourse/routes/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/routes/tags-show.js.es6 @@ -6,6 +6,11 @@ import PermissionType from "discourse/models/permission-type"; export default Discourse.Route.extend({ navMode: "latest", + queryParams: { + ascending: { refreshModel: true }, + order: { refreshModel: true } + }, + renderTemplate() { const controller = this.controllerFor("tags.show"); this.render("tags.show", { controller }); @@ -60,11 +65,13 @@ export default Discourse.Route.extend({ return tag; }, - afterModel(tag) { + afterModel(tag, transition) { const controller = this.controllerFor("tags.show"); controller.set("loading", true); const params = controller.getProperties("order", "ascending"); + params.order = transition.queryParams.order || params.order; + params.ascending = transition.queryParams.ascending || params.ascending; const categorySlug = this.get("categorySlug"); const parentCategorySlug = this.get("parentCategorySlug");