about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/column_back_button.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/mastodon/components/column_back_button.js')
-rw-r--r--app/javascript/mastodon/components/column_back_button.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/mastodon/components/column_back_button.js b/app/javascript/mastodon/components/column_back_button.js
index 8a60c4192..50c3bf11f 100644
--- a/app/javascript/mastodon/components/column_back_button.js
+++ b/app/javascript/mastodon/components/column_back_button.js
@@ -9,7 +9,8 @@ export default class ColumnBackButton extends React.PureComponent {
   };
 
   handleClick = () => {
-    if (window.history && window.history.length === 1) {
+    // if history is exhausted, or we would leave mastodon, just go to root.
+    if (window.history && (window.history.length === 1 || window.history.length === window._mastoInitialHistoryLen)) {
       this.context.router.history.push('/');
     } else {
       this.context.router.history.goBack();