11import { Outlet , createFileRoute , redirect , useLocation } from "@tanstack/react-router" ;
2- import { useState , type ReactNode } from "react" ;
2+ import { useMemo , useState , type ReactNode } from "react" ;
33import { RotateCcwIcon } from "lucide-react" ;
44import { Button } from "../components/ui/button" ;
55import { useSettingsRestore } from "../components/settings/SettingsPanels" ;
@@ -16,7 +16,10 @@ import {
1616} from "../components/settings/SettingsScopeContext" ;
1717import { useEnvironments } from "../state/environments" ;
1818import { SettingsScopeNotice } from "../components/settings/SettingsScopeNotice" ;
19- import { SETTINGS_DEVICE_ONLY_PATHS } from "../components/settings/SettingsScopeSentence" ;
19+ import {
20+ SETTINGS_DEVICE_ONLY_PATHS ,
21+ SETTINGS_ENVIRONMENT_ONLY_PATHS ,
22+ } from "../components/settings/SettingsScopeSentence" ;
2023import { SettingsPageContainer } from "../components/settings/settingsLayout" ;
2124import {
2225 retainSettingsScope ,
@@ -151,9 +154,14 @@ function SettingsRouteLayout() {
151154 const rawSearch = Route . useSearch ( ) ;
152155 const navigate = Route . useNavigate ( ) ;
153156 const pathname = useLocation ( { select : ( location ) => location . pathname } ) ;
157+ const environmentOnly = SETTINGS_ENVIRONMENT_ONLY_PATHS . has ( pathname ) ;
158+ const search = useMemo (
159+ ( ) => ( environmentOnly ? ( rawSearch . machine ? { machine : rawSearch . machine } : { } ) : rawSearch ) ,
160+ [ environmentOnly , rawSearch ] ,
161+ ) ;
154162 return (
155163 < SettingsScopeProvider
156- search = { rawSearch }
164+ search = { search }
157165 singleEnvironment = { pathname === "/settings/providers" }
158166 onChange = { ( next ) => {
159167 // Send every axis so the retain middleware sees an explicit target
0 commit comments