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.
This commit is contained in:
schroda
2024-06-05 22:48:00 +02:00
parent 19e326c8ad
commit 4bb458778e

View File

@@ -13,7 +13,7 @@ export const useHistory = () => {
const location = useLocation(); const location = useLocation();
const navigationType = useNavigationType(); const navigationType = useNavigationType();
const [history, setHistory] = useState<string[]>([location.pathname]); const [history, setHistory] = useState<string[]>([]);
useEffect(() => { useEffect(() => {
const isLastPageInHistory = location.key === 'default'; const isLastPageInHistory = location.key === 'default';