Remove most "useSetDefaultBackTo" usage

In case the "depth" of the initial opened app page was greater than 2 it was possible to get stuck in a loop of using the back button twice from the initial page to the previous page and back to the initial page...

Instead, in case a page with a greater depth than 0 is opened, the library should just be opened when using the back button.

This way the back button actually behaves like it's intended, as an app back button and not like the browsers back button
This commit is contained in:
schroda
2024-06-05 23:04:13 +02:00
parent 4bb458778e
commit 29d54384f5
13 changed files with 13 additions and 38 deletions

View File

@@ -14,7 +14,7 @@ import ListItem from '@mui/material/ListItem';
import ListItemText from '@mui/material/ListItemText';
import Switch from '@mui/material/Switch';
import ListSubheader from '@mui/material/ListSubheader';
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext.tsx';
import { NavBarContext } from '@/components/context/NavbarContext.tsx';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { useLocalStorage } from '@/util/useStorage.tsx';
import { TextSetting } from '@/components/settings/text/TextSetting.tsx';
@@ -79,8 +79,6 @@ export const ServerSettings = () => {
const { t } = useTranslation();
const { setTitle, setAction } = useContext(NavBarContext);
useSetDefaultBackTo('settings');
useEffect(() => {
setTitle(t('settings.server.title.settings'));
setAction(null);