FIX: ensures routing with hash doesn't stuck history (#7872)

FIX: ensures routing with hash doesn’t stuck history (#7872)

  • FIX: ensures routin with hash doesnt stuck history

Original issue: Hash/anchor in url prevents further url updates - support - Discourse Meta

Basically when the path has a hash, state would be null, and nothing would happen.

  • Update app/assets/javascripts/discourse/lib/discourse-location.js.es6

Co-Authored-By: Régis Hanol regis@hanol.fr

diff --git a/app/assets/javascripts/discourse/lib/discourse-location.js.es6 b/app/assets/javascripts/discourse/lib/discourse-location.js.es6
index 4fd1c66..3843831 100644
--- a/app/assets/javascripts/discourse/lib/discourse-location.js.es6
+++ b/app/assets/javascripts/discourse/lib/discourse-location.js.es6
@@ -101,7 +101,7 @@ const DiscourseLocation = Ember.Object.extend({
     const state = this.getState();
     path = this.formatURL(path);
 
-    if (state && state.path !== path) {
+    if (!state || state.path !== path) {
       this.replaceState(path);
     }
   },

GitHub sha: 142344e4

1 Like