Skip to content

Commit

Permalink
[changed] Give ActiveState a chance to update state before mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Sep 25, 2014
1 parent 517e460 commit 6af24bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/mixins/ActiveState.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ var ActiveState = {
return this.context.activeDelegate;
},

componentWillMount: function () {
if (this.updateActiveState)
this.updateActiveState();
},

componentDidMount: function () {
this.getActiveDelegate().addChangeListener(this.handleActiveStateChange);
this.handleActiveStateChange();
Expand All @@ -55,7 +60,7 @@ var ActiveState = {
},

handleActiveStateChange: function () {
if (this.isMounted() && typeof this.updateActiveState === 'function')
if (this.isMounted() && this.updateActiveState)
this.updateActiveState();
},

Expand Down

0 comments on commit 6af24bd

Please sign in to comment.