MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / getFirstAvailablePath

Function getFirstAvailablePath

src/utils/settings-utils.ts:49–67  ·  view source on GitHub ↗
(
  featureFlags: WebClientFeatureFlags | undefined,
)

Source from the content-addressed store, hash-verified

47}
48
49export function getFirstAvailablePath(
50 featureFlags: WebClientFeatureFlags | undefined,
51): string | null {
52 // ``/settings/agents`` (the Agent Profile library — the "Agent" page) always
53 // wins: it is where the agent is defined (OpenHands / ACP, via the active
54 // profile) and is always available regardless of feature flags. Landing here
55 // keeps routing simple — every user lands where the agent is chosen, and
56 // the LLM page is one nav-click away.
57 const fallbackOrder = [
58 { path: "/settings/agents", hidden: false },
59 { path: "/settings/llm", hidden: !!featureFlags?.hide_llm_settings },
60 { path: "/settings", hidden: !!featureFlags?.hide_llm_settings },
61 { path: "/settings/app", hidden: false },
62 { path: "/settings/secrets", hidden: false },
63 ];
64
65 const firstAvailable = fallbackOrder.find((item) => !item.hidden);
66 return firstAvailable?.path ?? null;
67}

Callers 3

SettingsIndexFunction · 0.90
clientLoaderFunction · 0.90
settings.test.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected