Skip to content

Conversation

@charliepark
Copy link
Contributor

This fixes an issue that we were seeing with tabbed pages, where the sidebar navigation wasn't working as expected for tabbed pages.

Note how the "Inventory" link is "active" for the Sleds tab, but not the Disks tab:
Screenshot 2025-03-06 at 2 45 37 PM
Screenshot 2025-03-06 at 2 45 42 PM

This PR fixes NavLinks in the Sidebar by adding a toPrefix, which is essentially the first part of a URL path. If a link is given a toPrefix prop, that more generic string will be used when the component is determining if the tab should be rendered as "active" or not.

Here it is, fixed:
navlinks

@vercel
Copy link

vercel bot commented Mar 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Mar 7, 2025 1:31am

@david-crespo
Copy link
Collaborator

Looks good. What do you think about renaming toPrefix to activePrefix (both here and on the existing RouteTab one)? I came up with toPrefix but in hindsight it would be good to say what it’s for right in the name.

@charliepark
Copy link
Contributor Author

Yeah, agree that that's better. Will pick that up before merge.

@charliepark charliepark enabled auto-merge (squash) March 7, 2025 01:33
@charliepark charliepark merged commit 5241ad7 into main Mar 7, 2025
7 checks passed
@charliepark charliepark deleted the better-sidebar-nav-activity branch March 7, 2025 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants