mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +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
|
// the collapsibleNav by itself on click. setState() isn't available on a ref so
|
||||||
// doing this explicitly is the only way for now.
|
// doing this explicitly is the only way for now.
|
||||||
onRouteChange() {
|
onRouteChange() {
|
||||||
|
if (this.refs.navbar) {
|
||||||
this.refs.navbar.state.navExpanded = false;
|
this.refs.navbar.state.navExpanded = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
Reference in New Issue
Block a user