ref(nav) move isLinkActive and ProjectIcon inside components#110372
Merged
JonasBa merged 2 commits intojb/ref/navigation/naming-navfrom Mar 11, 2026
Merged
ref(nav) move isLinkActive and ProjectIcon inside components#110372JonasBa merged 2 commits intojb/ref/navigation/naming-navfrom
JonasBa merged 2 commits intojb/ref/navigation/naming-navfrom
Conversation
JonasBa
commented
Mar 10, 2026
| @@ -1,17 +0,0 @@ | |||
| import type {To} from '@remix-run/router'; | |||
Member
Author
There was a problem hiding this comment.
@malwilley I've changed this to LocationDescriptor, but lmk if it was intentional and should be preserved
Comment on lines
+518
to
+522
| export function isSidebarLinkActive( | ||
| to: LocationDescriptor | string, | ||
| pathname: string, | ||
| options: {end?: boolean} = {end: false} | ||
| ): boolean { |
Contributor
There was a problem hiding this comment.
Bug: The isSidebarLinkActive function normalizes the to path but not the pathname argument. This causes the active state check to fail for secondary navigation links.
Severity: MEDIUM
Suggested Fix
Normalize the pathname argument inside the isSidebarLinkActive function, similar to how the to argument is normalized. This will ensure both paths are compared in the same format, fixing the active state logic for secondary navigation.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/app/views/navigation/primary/components.tsx#L518-L522
Potential issue: The refactored `isSidebarLinkActive` function is used for both primary
and secondary navigation. For secondary navigation, it's called with a `pathname` that
includes the full URL path (e.g., `/organizations/org-slug/...`). However, the function
only normalizes its `to` argument, stripping prefixes like the organization slug. It
then compares the un-normalized `pathname` with the normalized `to` path using
`pathname.startsWith(toPathname)`. This comparison will always fail when an organization
slug is present, preventing secondary navigation links from being highlighted as active.
Did we get this right? 👍 / 👎 to inform future reviews.
malwilley
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves ProjectIcon inside Secondary Nav components, moves prop definitions next to component implementations and moves isLinkActive inside the primary nav component.