From 047695e554126f5467ed744c62d318001ac351af Mon Sep 17 00:00:00 2001 From: Louis Knight-Webb Date: Mon, 8 Dec 2025 16:45:08 +0000 Subject: [PATCH] Exiting settings should navigate to previous location (#1467) **Summary:** Updated `SettingsLayout.tsx` to simplify the `handleBack` function - now it always uses `navigate(-1)` to go back in browser history. This means pressing ESC (or clicking the X button) in Settings will return users to whatever page they came from. Removed the unused `useLocation` import as it was no longer needed. --- frontend/src/pages/settings/SettingsLayout.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/frontend/src/pages/settings/SettingsLayout.tsx b/frontend/src/pages/settings/SettingsLayout.tsx index d1181ade..e7db80ae 100644 --- a/frontend/src/pages/settings/SettingsLayout.tsx +++ b/frontend/src/pages/settings/SettingsLayout.tsx @@ -1,4 +1,4 @@ -import { NavLink, Outlet, useNavigate, useLocation } from 'react-router-dom'; +import { NavLink, Outlet, useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { Settings, Cpu, Server, X, FolderOpen, Building2 } from 'lucide-react'; import { cn } from '@/lib/utils'; @@ -44,14 +44,9 @@ export function SettingsLayout() { }, [enableScope, disableScope]); const navigate = useNavigate(); - const location = useLocation(); const handleBack = () => { - if (location.state?.from) { - navigate(-1); - } else { - navigate('/projects'); - } + navigate(-1); }; // Register ESC keyboard shortcut useKeyExit(handleBack, { scope: Scope.SETTINGS });