mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): only highlight Providers item on exact match in AI settings sidebar (#25700)
## Problem When visiting `/ai/settings/governance`, both **AI Governance** and **Providers** items in the AI settings subnav appear highlighted as active. ## Cause `SettingsSidebarNavItem` is built on react-router's `<NavLink>`, which by default treats a link as active when the current URL **starts with** the link's `to` path. Since `/ai/settings/governance` starts with `/ai/settings`, the Providers item is also marked active. ## Fix Pass `end` on the Providers nav item so it only matches when the path is exactly `/ai/settings` (the index route). The `SettingsSidebarNavItem` component already supports this prop for exactly this case. Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
blink-so[bot]
parent
be184a0591
commit
dd741bd188
@@ -22,7 +22,9 @@ const AISettingsSidebarView: FC<AISettingsSidebarViewProps> = ({
|
||||
AI Governance
|
||||
</SidebarNavItem>
|
||||
)}
|
||||
<SidebarNavItem href="/ai/settings">Providers</SidebarNavItem>
|
||||
<SidebarNavItem href="/ai/settings" end>
|
||||
Providers
|
||||
</SidebarNavItem>
|
||||
{permissions.editDeploymentConfig && (
|
||||
<SidebarNavItem href="/agents/settings/agents">
|
||||
<div className="flex flex-row items-center gap-1">
|
||||
|
||||
Reference in New Issue
Block a user