diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index 4c92f6da87f..516c53daf4e 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -19,6 +19,10 @@ const controllerOpts = { expandGloballyPinned: false, expandAllPinned: false, + resetParams() { + this.setProperties({ order: "default", ascending: false }); + }, + actions: { changeSort(sortBy) { @@ -43,8 +47,7 @@ const controllerOpts = { refresh() { const filter = this.get('model.filter'); - - this.setProperties({ order: "default", ascending: false }); + this.resetParams(); // Don't refresh if we're still loading if (this.get('discovery.loading')) { return; } diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index 8f1b1d3e133..488123dfbbf 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -326,6 +326,11 @@ const DiscourseURL = Ember.Object.extend({ if (opts.replaceURL) { this.replaceState(path); } else { + const discoveryTopics = this.controllerFor('discovery/topics'); + if (discoveryTopics) { + discoveryTopics.resetParams(); + } + router.router.updateURL(path); }