Preserve "SourceMangas" location state (#354)

Due to setting the "defaultBackTo" url the back button was a Link instead of a normal Button.
The Link causes the page to get opened like it's the first time and to get put on top of the browsers history stack. Instead of actually going back in the history.
Thus, the previous location state of the "SourceMangas" page was lost and the content type (browse, latest, filter) couldn't be reopened.
This commit is contained in:
schroda
2023-06-08 13:40:08 +02:00
committed by GitHub
parent 0446a01e85
commit cce6ec0113

View File

@@ -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, { useSetDefaultBackTo } from '@/components/context/NavbarContext';
import NavbarContext from '@/components/context/NavbarContext';
import ChapterList from '@/components/manga/ChapterList';
import { useRefreshManga } from '@/components/manga/hooks';
import MangaDetails from '@/components/manga/MangaDetails';
@@ -33,10 +33,6 @@ const Manga: React.FC = () => {
const [refresh, { loading: refreshing }] = useRefreshManga(id);
useSetDefaultBackTo(
manga?.inLibrary === false && manga.sourceId != null ? `/sources/${manga.sourceId}` : '/library',
);
useEffect(() => {
// Automatically fetch manga from source if data is older then 24 hours
// Automatic fetch is done only once, to prevent issues when server does