diff options
| author | Oskar <oskar@mullvad.net> | 2024-10-22 15:32:24 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2024-10-22 15:32:24 +0200 |
| commit | 1ec8c9d6c4dc799fb0c6479cdc9dad438bf37129 (patch) | |
| tree | 43caf1e9884496f64c2333648c16381eaa1cf18a /gui/src/renderer/components/AppRouter.tsx | |
| parent | 6533665d1fdf9a97e6ea1e36f01ee2f293b4338c (diff) | |
| parent | cf62ffdd17eac7958977895f098742c704aa3047 (diff) | |
| download | mullvadvpn-1ec8c9d6c4dc799fb0c6479cdc9dad438bf37129.tar.xz mullvadvpn-1ec8c9d6c4dc799fb0c6479cdc9dad438bf37129.zip | |
Merge branch 'add-react-linter-rules'
Diffstat (limited to 'gui/src/renderer/components/AppRouter.tsx')
| -rw-r--r-- | gui/src/renderer/components/AppRouter.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gui/src/renderer/components/AppRouter.tsx b/gui/src/renderer/components/AppRouter.tsx index e83b6f55cd..3541c095d6 100644 --- a/gui/src/renderer/components/AppRouter.tsx +++ b/gui/src/renderer/components/AppRouter.tsx @@ -48,23 +48,23 @@ export default function AppRouter() { const { setNavigationHistory } = useAppContext(); const focusRef = createRef<IFocusHandle>(); - let unobserveHistory: () => void; - useEffect(() => { // React throttles updates, so it's impossible to capture the intermediate navigation without // listening to the history directly. - unobserveHistory = history.listen((location, _, transition) => { + const unobserveHistory = history.listen((location, _, transition) => { setNavigationHistory(history.asObject); setCurrentLocation(location); setTransition(transition); }); - return () => unobserveHistory?.(); - }, []); + return () => { + unobserveHistory?.(); + }; + }, [history, setNavigationHistory]); const onNavigation = useCallback(() => { focusRef.current?.resetFocus(); - }, []); + }, [focusRef]); return ( <Focus ref={focusRef}> |
