77 type ComponentType ,
88 type KeyboardEvent ,
99} from "react" ;
10+ import { useEnvironmentQuery } from "~/state/query" ;
11+ import { desktopWslStateAtom } from "~/state/desktopWslState" ;
1012import {
1113 ArchiveIcon ,
1214 BlocksIcon ,
@@ -21,6 +23,7 @@ import {
2123} from "lucide-react" ;
2224import { useLocation , useNavigate } from "@tanstack/react-router" ;
2325
26+ import { isElectron } from "~/env" ;
2427import { Button } from "../ui/button" ;
2528import { Input } from "../ui/input" ;
2629import { Kbd } from "../ui/kbd" ;
@@ -38,6 +41,7 @@ import { SidebarUtilityMenu } from "../sidebar/SidebarChrome";
3841import { scrollToSettingsTarget } from "./settingsLayout" ;
3942import {
4043 searchSettings ,
44+ SETTINGS_SEARCH_ITEMS ,
4145 SETTINGS_SECTION_LABELS ,
4246 type SettingsPath ,
4347 type SettingsSearchItem ,
@@ -78,7 +82,15 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
7882 const searchInputRef = useRef < HTMLInputElement > ( null ) ;
7983 const [ query , setQuery ] = useState ( "" ) ;
8084 const [ activeResultIndex , setActiveResultIndex ] = useState ( 0 ) ;
81- const results = useMemo ( ( ) => searchSettings ( query ) , [ query ] ) ;
85+ const desktopWsl = useEnvironmentQuery ( isElectron ? desktopWslStateAtom : null ) ;
86+ const searchableItems = useMemo ( ( ) => {
87+ const wslState = desktopWsl . data ;
88+ if ( wslState ?. available || wslState ?. enabled || wslState ?. wslOnly ) {
89+ return SETTINGS_SEARCH_ITEMS ;
90+ }
91+ return SETTINGS_SEARCH_ITEMS . filter ( ( item ) => item . id !== "wsl-backend" ) ;
92+ } , [ desktopWsl . data ] ) ;
93+ const results = useMemo ( ( ) => searchSettings ( query , searchableItems ) , [ query , searchableItems ] ) ;
8294 const isSearching = query . trim ( ) . length > 0 ;
8395 const hasResults = results . length > 0 ;
8496
0 commit comments