diff options
| -rw-r--r-- | gui/src/renderer/routes.tsx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gui/src/renderer/routes.tsx b/gui/src/renderer/routes.tsx index e4256af994..96a7ee4b82 100644 --- a/gui/src/renderer/routes.tsx +++ b/gui/src/renderer/routes.tsx @@ -15,6 +15,7 @@ import SelectLocationPage from './containers/SelectLocationPage'; import SettingsPage from './containers/SettingsPage'; import SupportPage from './containers/SupportPage'; import WireguardKeysPage from './containers/WireguardKeysPage'; +import History from './lib/history'; import { getTransitionProps } from './transitions'; interface IAppRoutesState { @@ -38,12 +39,14 @@ class AppRoutes extends React.Component<RouteComponentProps, IAppRoutesState> { public componentDidMount() { // React throttles updates, so it's impossible to capture the intermediate navigation without // listening to the history directly. - this.unobserveHistory = this.props.history.listen((location) => { - this.setState((state) => ({ - previousLocation: state.currentLocation, - currentLocation: location, - })); - }); + this.unobserveHistory = (this.props.history as History).listen( + (location, _action, affectedEntries) => { + this.setState({ + previousLocation: affectedEntries[0], + currentLocation: location, + }); + }, + ); } public componentWillUnmount() { |
