From 4bb458778e715e564449f60c5778da44dd7b22cf Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:48:00 +0200 Subject: [PATCH] Exclude initial page form history stack In case the initial opened page had a "depth" of 2 or more, using the back button twice lead to the initial page to get opened again instead of decreasing the depth of the url. E.g. in case the reader was opened as the initial app page, closing the reader and then clicking the back button caused the reader to get opened again instead of going "back" to the library. --- src/util/useHistory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/useHistory.ts b/src/util/useHistory.ts index fee813de..2aa9bf20 100644 --- a/src/util/useHistory.ts +++ b/src/util/useHistory.ts @@ -13,7 +13,7 @@ export const useHistory = () => { const location = useLocation(); const navigationType = useNavigationType(); - const [history, setHistory] = useState([location.pathname]); + const [history, setHistory] = useState([]); useEffect(() => { const isLastPageInHistory = location.key === 'default';