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

View file

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