mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Hotfix for header accessing undefined ref
Sometimes `onRouteChange()` is triggered before the component’s refs are available, so we have to check for them before setting their state.
This commit is contained in:
parent
b467a840a4
commit
6e9b1ac181
@ -140,7 +140,9 @@ let Header = React.createClass({
|
||||
// the collapsibleNav by itself on click. setState() isn't available on a ref so
|
||||
// doing this explicitly is the only way for now.
|
||||
onRouteChange() {
|
||||
this.refs.navbar.state.navExpanded = false;
|
||||
if (this.refs.navbar) {
|
||||
this.refs.navbar.state.navExpanded = false;
|
||||
}
|
||||
},
|
||||
|
||||
render() {
|
||||
|
Loading…
Reference in New Issue
Block a user