Skip to content

Commit

Permalink
Preserve "SourceMangas" location state (#354)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
schroda authored Jun 8, 2023
1 parent 0446a01 commit cce6ec0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/screens/Manga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand Down

0 comments on commit cce6ec0

Please sign in to comment.