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

Function getFirstAvailablePath

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

Source from the content-addressed store, hash-verified

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

Callers 3

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

Calls

no outgoing calls

Tested by

no test coverage detected