Fix/back button not working without browser history (#389)
* Introduce local history stack To be able to know if the browser back navigation should be used, it is sometimes necessary to know which the previous page was. E.g. it should not be used in case the current page is the manga page and the previous one is the reader. * Handle cases where there is no previous page in the history stack * Always use a button for the navigation back button * Navigate from base route to library by replacing the current location The base route should not be included in the history
This commit is contained in:
@@ -12,7 +12,7 @@ import React, { useContext, useEffect, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import requestManager from '@/lib/RequestManager';
|
||||
import NavbarContext from '@/components/context/NavbarContext';
|
||||
import NavbarContext, { useSetDefaultBackTo } from '@/components/context/NavbarContext';
|
||||
import ChapterList from '@/components/manga/ChapterList';
|
||||
import { useRefreshManga } from '@/components/manga/hooks';
|
||||
import MangaDetails from '@/components/manga/MangaDetails';
|
||||
@@ -32,6 +32,7 @@ const Manga: React.FC = () => {
|
||||
const { data: manga, error, isLoading, isValidating, mutate } = requestManager.useGetManga(id);
|
||||
|
||||
const [refresh, { loading: refreshing }] = useRefreshManga(id);
|
||||
useSetDefaultBackTo('library');
|
||||
|
||||
useEffect(() => {
|
||||
// Automatically fetch manga from source if data is older then 24 hours
|
||||
|
||||
Reference in New Issue
Block a user