File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 2020
2121import React , { Component , Fragment } from 'react' ;
2222import { debounce } from 'throttle-debounce' ;
23- import { Link } from 'react-router-dom' ;
23+ import { Link , withRouter } from 'react-router-dom' ;
2424import List from '@material-ui/core/List' ;
2525import ListItem from '@material-ui/core/ListItem' ;
2626import Collapse from '@material-ui/core/Collapse' ;
@@ -46,6 +46,16 @@ class MenuBar extends Component {
4646 } ;
4747 }
4848
49+ componentDidUpdate ( ) {
50+ const history = this . props . history ;
51+ const pathname = history . location . pathname ;
52+ if ( ! pathname . endsWith ( this . state . activePkg ) ) {
53+ this . setState ( {
54+ activePkg : pathname . substring ( pathname . indexOf ( '@stdlib' ) )
55+ } ) ;
56+ }
57+ }
58+
4959 handleDrawerOpen = ( ) => {
5060 this . props . onDrawerChange ( true ) ;
5161 }
@@ -281,4 +291,4 @@ class MenuBar extends Component {
281291
282292// EXPORTS //
283293
284- export default MenuBar ;
294+ export default withRouter ( MenuBar ) ;
You can’t perform that action at this time.
0 commit comments