From f472bf8585a62066b7817207e0223e7c9d25f762 Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Sat, 1 Nov 2014 15:35:26 +0100 Subject: [PATCH] improved logic to set inital active pane --- public/js/components/TabView.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/js/components/TabView.jsx b/public/js/components/TabView.jsx index b1ad225b09..f07695a27f 100644 --- a/public/js/components/TabView.jsx +++ b/public/js/components/TabView.jsx @@ -6,19 +6,19 @@ var TabView = React.createClass({ }, getInitialState: function() { - return {activeTab: this.props.tabPanes[0]}; - }, + var activeTab = this.props.tabPanes[0]; - componentDidMount:function() { var userHash = window.location.hash; if(userHash) { userHash = userHash.split("#")[1]; this.props.tabPanes.forEach(function(pane) { - if(pane.name === userHash) { - this.setState({activeTab: pane}) - } + if(pane.name === userHash) { + activeTab = pane; + } }.bind(this)); } + + return {activeTab: activeTab}; }, handleChangeTab: function(tabPane) {