@@ -138,6 +138,7 @@ import { buildSidebarProjectSnapshots } from "../../sidebarProjectGrouping";
138138import { ProjectSettingsPanel } from "./ProjectSettingsPanel" ;
139139import { ProjectsSettings } from "./ProjectsSettings" ;
140140import { SettingsScopeProvider } from "./SettingsScopeContext" ;
141+ import { SettingsScopeNotice } from "./SettingsScopeNotice" ;
141142import { validateSettingsScopeSearch , type SettingsScopeSearch } from "./settingsScope" ;
142143import { retainSettingsScope , validateSettingsRouteSearch } from "./settingsScopeNavigation" ;
143144
@@ -533,6 +534,48 @@ describe("project identity reset", () => {
533534 } ) ;
534535} ) ;
535536
537+ it ( "opens the fallback search target across all environments from a checkout" , async ( ) => {
538+ setup ( ) ;
539+ const root = createRootRoute ( ) ;
540+ const settings = createRoute ( {
541+ getParentRoute : ( ) => root ,
542+ path : "settings" ,
543+ validateSearch : validateSettingsRouteSearch ,
544+ search : { middlewares : [ retainSettingsScope ] } ,
545+ } ) ;
546+ const threads = createRoute ( {
547+ getParentRoute : ( ) => settings ,
548+ path : "threads" ,
549+ component : ( ) => (
550+ < SettingsScopeProvider search = { settings . useSearch ( ) } onChange = { ( ) => { } } >
551+ < SettingsScopeNotice target = "all" targetId = "fallback-model" >
552+ Choose all environments to edit the fallback model.
553+ </ SettingsScopeNotice >
554+ </ SettingsScopeProvider >
555+ ) ,
556+ } ) ;
557+ const query = new URLSearchParams ( {
558+ project : projectKey ( ) ,
559+ machine : primaryId ,
560+ checkout : "primary:/work/primary" ,
561+ } ) ;
562+ const router = createRouter ( {
563+ routeTree : root . addChildren ( [ settings . addChildren ( [ threads ] ) ] ) ,
564+ history : createMemoryHistory ( { initialEntries : [ `/settings/threads?${ query } #fallback-model` ] } ) ,
565+ } ) ;
566+ await router . load ( ) ;
567+ // This route needs the real scope-retention middleware used by settings search.
568+ await using _screen = await render (
569+ < RegistryContext . Provider value = { appAtomRegistry } >
570+ < RouterProvider router = { router } />
571+ </ RegistryContext . Provider > ,
572+ { router : false } ,
573+ ) ;
574+ await userEvent . click ( page . getByRole ( "button" , { name : "Open all environments" } ) ) ;
575+ await vi . waitFor ( ( ) => expect ( router . state . location . search ) . toEqual ( { } ) ) ;
576+ expect ( router . state . location . hash ) . toBe ( "fallback-model" ) ;
577+ } ) ;
578+
536579describe ( "project settings scope" , ( ) => {
537580 const environmentMenu = ( ) => page . getByRole ( "button" , { name : / ^ E n v i r o n m e n t s c o p e : / } ) ;
538581 const primaryOption = ( ) => page . getByRole ( "menuitemradio" , { name : / ^ p r i m a r y / } ) ;
0 commit comments