Skip to content

ref(issue-details): replace useRouter with specific hooks in useGroupDetailsRoute#110122

Merged
evanpurkhiser merged 5 commits intomasterfrom
evanpurkhiser-remove-userouter-use-group-details-route
Mar 27, 2026
Merged

ref(issue-details): replace useRouter with specific hooks in useGroupDetailsRoute#110122
evanpurkhiser merged 5 commits intomasterfrom
evanpurkhiser-remove-userouter-use-group-details-route

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

Part of the React Router 6 cleanup — replaces useRouter() with specific hooks (useNavigate, useLocation, useParams, etc.)

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner March 6, 2026 18:27
@evanpurkhiser evanpurkhiser requested a review from a team March 6, 2026 18:27
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 6, 2026
Comment on lines +37 to 41
params: Record<string, string | undefined>;
routes: PlainRoute[];
}): {
baseUrl: string;
currentTab: Tab;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The getCurrentTab function always defaults to the 'Details' tab because route objects are missing the handle.path property, causing currentRoute.path to be an empty string.
Severity: HIGH

Suggested Fix

Update the route definitions for the issue detail tabs to include a handle object with a path property that mirrors the existing path value. For example, a route with path: TabPaths[Tab.ACTIVITY] should also have handle: { path: TabPaths[Tab.ACTIVITY] }. This will ensure useRoutes() correctly populates the path property on the route object, allowing getCurrentTab() to identify the active tab.

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/issueDetails/useGroupDetailsRoute.tsx#L37-L41

Potential issue: The `useRoutes()` hook creates route objects where the `path` is
derived from `match.handle?.path ?? ''`. However, the route definitions for the issue
details tabs do not include a `handle` object with a `path` property. Consequently, when
`getCurrentTab()` runs, the `currentRoute.path` is always an empty string. The logic to
find the active tab, `Object.values(Tab).find(tab => currentRoute?.path ===
TabPaths[tab])`, will always fail to find a match, causing it to fall back to the
default `Tab.DETAILS`. This prevents the UI from correctly highlighting the active tab
on the issue details page.

Did we get this right? 👍 / 👎 to inform future reviews.

@evanpurkhiser evanpurkhiser enabled auto-merge (squash) March 16, 2026 20:22
@evanpurkhiser evanpurkhiser merged commit 1636a61 into master Mar 27, 2026
69 of 70 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser-remove-userouter-use-group-details-route branch March 27, 2026 15:29
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 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