From 1b7389918268884ea4760f2e0c0f2676f6a08d1e Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 5 Aug 2020 18:32:38 +0300 Subject: [PATCH] Appbar: make sure it changes when the location changes. --- src/App.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index a600ad1..f33663e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -99,15 +99,16 @@ interface AppBarPropsType { } function AppBarWitHistory(props: AppBarPropsType) { + const location = useLocation(); const history = useHistory(); function canGoBack() { return ( (history!.length > 1) && - (history!.location.pathname !== routeResolver.getRoute("pim.contacts")) && - (history!.location.pathname !== routeResolver.getRoute("pim.events")) && - (history!.location.pathname !== routeResolver.getRoute("pim.tasks")) && - (history!.location.pathname !== routeResolver.getRoute("home")) + (location.pathname !== routeResolver.getRoute("pim.contacts")) && + (location.pathname !== routeResolver.getRoute("pim.events")) && + (location.pathname !== routeResolver.getRoute("pim.tasks")) && + (location.pathname !== routeResolver.getRoute("home")) ); }