Skip to content

A platform for community discussion. Free, open, simple.

FIX: Don't push browser state if navigated from root url to home page url and vice versa

Vinoth Kannan0861ca7764d3
diff --git a/app/assets/javascripts/discourse/lib/discourse-location.js.es6 b/app/assets/javascripts/discourse/lib/discourse-location.js.es6
index 576b135de89..f2585af0576 100644
--- a/app/assets/javascripts/discourse/lib/discourse-location.js.es6
+++ b/app/assets/javascripts/discourse/lib/discourse-location.js.es6
@@ -1,3 +1,5 @@
+import { defaultHomepage } from "discourse/lib/utilities";
+
/**
@module Discourse
*/
@@ -87,7 +89,10 @@ const DiscourseLocation = Ember.Object.extend({
path = this.formatURL(path);
if (state && state.path !== path) {
- this.pushState(path);
+ const paths = [path, state.path];
+ if (!(paths.includes("/") && paths.includes(`/${defaultHomepage()}`))) {
+ this.pushState(path);
+ }
}
},