Skip to content

fix(prevent): Improve redirects to pages that exist wrt the Prevent main nav button#106489

Merged
ryan953 merged 2 commits intomasterfrom
ryan953/prevent-nav-items-2
Jan 20, 2026
Merged

fix(prevent): Improve redirects to pages that exist wrt the Prevent main nav button#106489
ryan953 merged 2 commits intomasterfrom
ryan953/prevent-nav-items-2

Conversation

@ryan953
Copy link
Member

@ryan953 ryan953 commented Jan 17, 2026

This is a followup to #105346

In that previous PR i added a redirect to the AI config page, which would kick you out of the Prevent area making the Test Analytics pages inaccessible. This changes the url within the main nav to point to whichever sub-nav items are available. You'll get either:

  • code-review page if both code-review and test analytics are enabled
  • code-review page if it's the only one enabled.
  • test analytics page if that's the only one enabled.

also fixed the navigate() call to be a proper redirect, replacing the url instead of appending to history.

@ryan953 ryan953 requested a review from a team as a code owner January 17, 2026 00:33
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 17, 2026
@ryan953 ryan953 requested review from a team January 17, 2026 00:34
Copy link
Member

@shashjar shashjar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left one nit

</SidebarLink>
) : (
<SidebarLink
to={`/${prefix}/${PREVENT_BASE_URL}/${PREVENT_AI_BASE_URL}/new/`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we able to use makePreventPathname here as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm thinking i'm going to skip makePreventPathname in both places. None of the other links use a make* function like that, so they're not having normalizeUrl() called on the url either.

The Prevent grouping is going away, so i don't want to be making a new pattern inside it. We could/should make urls easier to deal with, but we can followup and do that across a wider swath of code.

@ryan953 ryan953 merged commit 66061e0 into master Jan 20, 2026
53 checks passed
@ryan953 ryan953 deleted the ryan953/prevent-nav-items-2 branch January 20, 2026 18:56
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants