From 5f6f7aaa27d165b65c19e1df3e383867570a1bc2 Mon Sep 17 00:00:00 2001 From: Kibigo Date: Tue, 28 Feb 2017 22:24:34 -0800 Subject: [PATCH] Making the back button a little smarter --- .../javascripts/components/components/column_back_button.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/components/components/column_back_button.jsx b/app/assets/javascripts/components/components/column_back_button.jsx index 6abf1123..6b5ffee5 100644 --- a/app/assets/javascripts/components/components/column_back_button.jsx +++ b/app/assets/javascripts/components/components/column_back_button.jsx @@ -15,7 +15,8 @@ const ColumnBackButton = React.createClass({ mixins: [PureRenderMixin], handleClick () { - this.context.router.goBack(); + if (window.history && window.history.length == 1) this.context.router.push("/"); + else this.context.router.goBack(); }, render () {