The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a ?tab=web-access link no longer opens Web Access where Settings hides it
emozillab5f16d5a1480
diff --git a/apps/desktop/src/app/settings/index.tsx b/apps/desktop/src/app/settings/index.tsxindex 5831afbbbd8..d761eaa8613 100644--- a/apps/desktop/src/app/settings/index.tsx+++ b/apps/desktop/src/app/settings/index.tsx@@ -246,6 +246,13 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Setconst webAccessAvailable = useWebAccessAvailable()+ // Where the nav hides Web Access, its deep link lands on Gateways, like the Connections alias.+ useEffect(() => {+ if (activeView === 'web-access' && !webAccessAvailable) {+ setActiveView('gateway')+ }+ }, [activeView, setActiveView, webAccessAvailable])+const navGroups: OverlayNavGroup[] = useMemo(() =>(diff --git a/apps/desktop/src/app/settings/web-access-settings.test.tsx b/apps/desktop/src/app/settings/web-access-settings.test.tsxindex 325d594e3dc..0f7c8d99a89 100644--- a/apps/desktop/src/app/settings/web-access-settings.test.tsx+++ b/apps/desktop/src/app/settings/web-access-settings.test.tsx@@ -1,3 +1,9 @@+const platform = vi.hoisted(() => ({ browserHosted: false }))++vi.mock('@/lib/platform', async (importOriginal): Promise<object> => ({+ ...(await importOriginal<object>()),+ isBrowserHostedDesktop: (): boolean => platform.browserHosted+}))vi.mock('@/store/profile', async (): Promise<object> => {const { atom } = await import('nanostores')@@ -57,6 +63,7 @@ beforeEach(() => queryClient.clear())afterEach(() => {cleanup()clearNotifications()+ platform.browserHosted = falsevi.clearAllMocks()})@@ -144,4 +151,14 @@ describe('WebAccessSettings', () => {expect(toast.message).toMatch(/^Saved\. A chat is running/)expect(JSON.stringify(toast)).not.toMatch(/Refusing|interrupt|Couldn't change/)})++ it('shows nothing and asks nothing where the settings nav hides it', async () => {+ // `?tab=web-access` in the Webapp: the nav has no Web Access entry there.+ platform.browserHosted = true+ renderPane(OFF)++ await new Promise(resolve => setTimeout(resolve, 50))+ expect(mocked.getWebAccessStatus).not.toHaveBeenCalled()+ expect(screen.queryByRole('button', { name: 'Start' })).toBeNull()+ })})diff --git a/apps/desktop/src/app/settings/web-access-settings.tsx b/apps/desktop/src/app/settings/web-access-settings.tsxindex 3c6387a772a..7ffa588af11 100644--- a/apps/desktop/src/app/settings/web-access-settings.tsx+++ b/apps/desktop/src/app/settings/web-access-settings.tsx@@ -78,11 +78,24 @@ export function useWebAccessAvailable(): boolean {return !isBrowserHostedDesktop() && connection?.mode !== 'remote'}-export function WebAccessSettings(): ReactElement {+export function WebAccessSettings(): ReactElement | null {const { t } = useI18n()const w = t.settings.gateway.webAccessconst key = ['web-access', JSON.stringify(useStore($apiRequestScope))]- const { data: status, error } = useQuery({ queryFn: getWebAccessStatus, queryKey: key, retry: false })+ // A `?tab=web-access` link can reach this pane where the nav hides it: there it neither asks the+ // backend nor shows anything.+ const available = useWebAccessAvailable()++ const { data: status, error } = useQuery({+ enabled: available,+ queryFn: getWebAccessStatus,+ queryKey: key,+ retry: false+ })++ if (!available) {+ return null+ }if (!status) {return error ? <SettingsContent>{w.failed}</SettingsContent> : <SettingsSkeleton sections={[{ rows: 2 }]} />