diff --git a/src/components/navigation/BottomNavigation.tsx b/src/components/navigation/BottomNavigation.tsx index ed2af95c..e0b5faf1 100644 --- a/src/components/navigation/BottomNavigation.tsx +++ b/src/components/navigation/BottomNavigation.tsx @@ -67,13 +67,13 @@ export default observer(() => { onClick={() => { if (settingsActive) { if (history.length > 0) { - history.goBack(); + history.replace(layout.getLastPath()); return; } } const path = layout.getLastHomePath(); - if (path === "/friends") { + if (path.startsWith("/friends")) { history.push("/"); } else { history.push(path); diff --git a/src/pages/settings/GenericSettings.tsx b/src/pages/settings/GenericSettings.tsx index 90e7ac9a..e2397479 100644 --- a/src/pages/settings/GenericSettings.tsx +++ b/src/pages/settings/GenericSettings.tsx @@ -55,20 +55,17 @@ export function GenericSettings({ indexHeader, }: Props) { const history = useHistory(); - const theme = useApplicationState().settings.theme; + const state = useApplicationState(); + const theme = state.settings.theme; const { page } = useParams<{ page: string }>(); const [closing, setClosing] = useState(false); const exitSettings = useCallback(() => { - if (history.length > 1) { - setClosing(true); + setClosing(true); - setTimeout(() => { - history.goBack(); - }, 100); - } else { - history.push("/"); - } + setTimeout(() => { + history.replace(state.layout.getLastPath()); + }, 100); }, [history]); useEffect(() => {