Skip to content

Commit a49444b

Browse files
committed
fixup! ref(issue-details): replace useRouter with specific hooks in useGroupDetailsRoute
1 parent 15f8280 commit a49444b

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

static/app/views/issueDetails/useGroupDetailsRoute.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import type {PlainRoute} from 'sentry/types/legacyReactRouter';
2-
import type {Organization} from 'sentry/types/organization';
3-
import {normalizeUrl} from 'sentry/utils/url/normalizeUrl';
4-
import {useOrganization} from 'sentry/utils/useOrganization';
5-
import {useParams} from 'sentry/utils/useParams';
6-
import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
1+
import type { PlainRoute } from "sentry/types/legacyReactRouter";
2+
import type { Organization } from "sentry/types/organization";
3+
import { normalizeUrl } from "sentry/utils/url/normalizeUrl";
4+
import { useOrganization } from "sentry/utils/useOrganization";
5+
import { useParams } from "sentry/utils/useParams";
6+
import { useRoutes } from "sentry/utils/useRoutes";
7+
import { Tab, TabPaths } from "sentry/views/issueDetails/types";
78

89
function getCurrentTab({
910
routes,
@@ -19,7 +20,8 @@ function getCurrentTab({
1920
return Tab.DISTRIBUTIONS;
2021
}
2122
return (
22-
Object.values(Tab).find(tab => currentRoute?.path === TabPaths[tab]) ?? Tab.DETAILS
23+
Object.values(Tab).find((tab) => currentRoute?.path === TabPaths[tab]) ??
24+
Tab.DETAILS
2325
);
2426
}
2527

@@ -39,23 +41,27 @@ function getCurrentRouteInfo({
3941
baseUrl: string;
4042
currentTab: Tab;
4143
} {
42-
const currentTab = getCurrentTab({routes, params});
44+
const currentTab = getCurrentTab({ routes, params });
4345

4446
const baseUrl = normalizeUrl(
4547
`/organizations/${organization.slug}/issues/${groupId}/${
46-
params.eventId && eventId ? `events/${eventId}/` : ''
48+
params.eventId && eventId ? `events/${eventId}/` : ""
4749
}`
4850
);
4951

50-
return {baseUrl, currentTab};
52+
return { baseUrl, currentTab };
5153
}
5254

5355
export function useGroupDetailsRoute(): {
5456
baseUrl: string;
5557
currentTab: Tab;
5658
} {
5759
const organization = useOrganization();
58-
const params = useParams<{groupId: string; eventId?: string; tagKey?: string}>();
60+
const params = useParams<{
61+
groupId: string;
62+
eventId?: string;
63+
tagKey?: string;
64+
}>();
5965
const routes = useRoutes();
6066
return getCurrentRouteInfo({
6167
groupId: params.groupId,

0 commit comments

Comments
 (0)