diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-04-14 13:23:02 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-04-20 10:51:21 +0200 |
| commit | 9a07f80b235382232ba3c3f34c83e2ce8931aaa8 (patch) | |
| tree | f9a7c76076d5bb3f421b604a270ec3e28903f8d0 /gui/src/renderer/components | |
| parent | fbdf3932b450ab65940f9f006db05cd35ff10704 (diff) | |
| download | mullvadvpn-9a07f80b235382232ba3c3f34c83e2ce8931aaa8.tar.xz mullvadvpn-9a07f80b235382232ba3c3f34c83e2ce8931aaa8.zip | |
Remember history when replacing window
Diffstat (limited to 'gui/src/renderer/components')
| -rw-r--r-- | gui/src/renderer/components/AppRouter.tsx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gui/src/renderer/components/AppRouter.tsx b/gui/src/renderer/components/AppRouter.tsx index d061c7b9d5..18a8b51063 100644 --- a/gui/src/renderer/components/AppRouter.tsx +++ b/gui/src/renderer/components/AppRouter.tsx @@ -12,6 +12,7 @@ import SelectLocationPage from '../containers/SelectLocationPage'; import SettingsPage from '../containers/SettingsPage'; import SupportPage from '../containers/SupportPage'; import WireguardSettingsPage from '../containers/WireguardSettingsPage'; +import withAppContext, { IAppContext } from '../context'; import { IHistoryProps, ITransitionSpecification, transitions, withHistory } from '../lib/history'; import { RoutePath } from '../lib/routes'; import { DeviceRevokedView } from './DeviceRevokedView'; @@ -36,12 +37,12 @@ interface IAppRoutesState { action?: Action; } -class AppRouter extends React.Component<IHistoryProps, IAppRoutesState> { +class AppRouter extends React.Component<IHistoryProps & IAppContext, IAppRoutesState> { private unobserveHistory?: () => void; private focusRef = React.createRef<IFocusHandle>(); - constructor(props: IHistoryProps) { + constructor(props: IHistoryProps & IAppContext) { super(props); this.state = { @@ -54,6 +55,7 @@ class AppRouter extends React.Component<IHistoryProps, IAppRoutesState> { // 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, action, transition) => { + this.props.app.setNavigationHistory(this.props.history.asObject); this.setState({ currentLocation: location, transition, @@ -114,6 +116,6 @@ class AppRouter extends React.Component<IHistoryProps, IAppRoutesState> { }; } -const AppRoutesWithRouter = withHistory(AppRouter); +const AppRoutesWithRouter = withAppContext(withHistory(AppRouter)); export default AppRoutesWithRouter; |
