[Discover] Fix issue where Discover breadcrumb link breaks in surrounding documents after filters have been added or modified

This commit is contained in:
Davis McPhee 2022-07-08 23:48:13 -03:00
parent 948fb53e4a
commit f577e463d4

View file

@ -66,7 +66,14 @@ const getCurrentBreadcrumbs = (
export const useMainRouteBreadcrumb = () => {
// useRef needed to retrieve initial breadcrumb link from the push state without updates
return useRef(useHistory<HistoryState>().location.state?.breadcrumb).current;
const breadcrumb = useRef<string>();
const history = useHistory<HistoryState>();
if (history.location.state?.breadcrumb) {
breadcrumb.current = history.location.state.breadcrumb;
}
return breadcrumb.current;
};
export const useNavigationProps = ({