fixed react warning

This commit is contained in:
Peter Cottle 2015-04-20 17:19:53 +10:00
parent 57a1905e7d
commit 97723a1150
2 changed files with 9 additions and 4 deletions

View file

@ -16,15 +16,19 @@ var LevelToolbarView = React.createClass({
getInitialState: function() {
return {
isHidden: true,
isGoalExpanded: false
isGoalExpanded: this.props.parent.getIsGoalExpanded()
};
},
componentDidMount: function() {
this.setState({
isHidden: false
isHidden: this.props.parent.getIsGoalExpanded()
});
this.props.parent.on('goalToggled', function() {
if (!this.isMounted()) {
return;
}
this.setState({
isGoalExpanded: this.props.parent.getIsGoalExpanded()
});
@ -57,8 +61,8 @@ var LevelToolbarView = React.createClass({
onClick={this.props.onGoalClick}
type="button">
{this.state.isGoalExpanded ?
intl.str('show-goal-button') :
intl.str('hide-goal-button')
intl.str('hide-goal-button') :
intl.str('show-goal-button')
}
</button>
</div>

View file

@ -10,6 +10,7 @@ var MyError = Backbone.Model.extend({
getMsg: function() {
if (!this.get('msg')) {
debugger;
console.warn('mye rror without message');
}
return this.get('msg');