FIX: Back button would go to previous topic instead of list

FIX: Back button would go to previous topic instead of list

See related topic: Back button history not properly working - bug - Discourse Meta

The issue here is the transition was not completing properly which meant if you backed out of a topic quickly and entered a new one, hitting back in the second topic would sometimes take you to the previous one instead of back to the topic list.

diff --git a/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6
index c545cff..70f5640 100644
--- a/app/assets/javascripts/discourse/routes/topic-from-params.js.es6
+++ b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6
@@ -89,6 +89,10 @@ export default Discourse.Route.extend({
         "previousURL",
         document.location.pathname
       );
+
+      // NOTE: omitting this return can break the back button when transitioning quickly between
+      // topics and the latest page.
+      return true;
     }
   }
 });

GitHub sha: de6edf9e

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: