diff --git a/src/Common/hooks/useAppHistory.ts b/src/Common/hooks/useAppHistory.ts index 893b1a06cfd..70ad92692de 100644 --- a/src/Common/hooks/useAppHistory.ts +++ b/src/Common/hooks/useAppHistory.ts @@ -10,14 +10,12 @@ export default function useAppHistory() { const resetHistory = useContext(ResetHistoryContext); const goBack = (fallbackUrl?: string) => { - if (history.length > 1) - // Navigate to history present in the app navigation history stack. - return navigate(history[1]); - if (fallbackUrl) - // Otherwise, use provided fallback url if provided. + // use provided fallback url if provided. return navigate(fallbackUrl); - + if (history.length > 1) + // Otherwise, navigate to history present in the app navigation history stack. + return navigate(history[1]); // Otherwise, fallback to browser's go back behaviour. window.history.back(); };