Remove "default back to" functionality

Caused an infinite loop, because in case the Reader was the initial opened page, got closed and the back button was pressed, the Reader just got opened again.

This happened because in case it was the initial opened page, closing the Reader did not use the browser back navigation and instead opened the Manga page, resulting in it to be pushed in the history stack with the Reader being the previous page
This commit is contained in:
schroda
2024-06-14 13:43:15 +02:00
parent 87eb5eaf53
commit 36e943214c
4 changed files with 3 additions and 28 deletions

View File

@@ -16,7 +16,6 @@ interface IProps {
}
export function NavBarContextProvider({ children }: IProps) {
const [defaultBackTo, setDefaultBackTo] = useState<string | undefined>();
const [title, setTitle] = useState<string | React.ReactNode>('Suwayomi');
const [action, setAction] = useState<any>(<div />);
const [override, setOverride] = useState<INavbarOverride>({
@@ -37,8 +36,6 @@ export function NavBarContextProvider({ children }: IProps) {
const value = useMemo(
() => ({
history,
defaultBackTo,
setDefaultBackTo,
title,
setTitle: updateTitle,
action,
@@ -46,7 +43,7 @@ export function NavBarContextProvider({ children }: IProps) {
override,
setOverride,
}),
[history, defaultBackTo, setDefaultBackTo, title, updateTitle, action, setAction, override, setOverride],
[history, title, updateTitle, action, setAction, override, setOverride],
);
return <NavBarContext.Provider value={value}>{children}</NavBarContext.Provider>;
}

View File

@@ -30,7 +30,6 @@ import { useTranslation } from 'react-i18next';
import { AllowedMetadataValueTypes, ChapterOffset, IReaderSettings, TChapter, TManga } from '@/typings';
import { ReaderSettingsOptions } from '@/components/reader/ReaderSettingsOptions';
import { useBackButton } from '@/util/useBackButton.ts';
import { useSetDefaultBackTo } from '@/components/context/NavbarContext.tsx';
import { Select } from '@/components/atoms/Select.tsx';
import { getOptionForDirection } from '@/theme.ts';
@@ -155,7 +154,6 @@ export function ReaderNavBar(props: IProps) {
} = props;
const handleBack = useBackButton();
useSetDefaultBackTo(`/manga/${manga.id}`);
const hasMultipleScanlators = useMemo(() => !!new Set(chapters.map(({ scanlator }) => scanlator)).size, [chapters]);