Skip to content

Commit ec0fc3d

Browse files
authored
fix(insights): view query summary button broken (#81327)
The view query summary button should be using `useModuleUrl`, this is a shared function that returns the appropriate module url. Previously the button did not use this hook, and when we updated the module urls, the old url was left here.
1 parent bf9592d commit ec0fc3d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

static/app/components/events/interfaces/spans/spanDetail.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ describe('SpanDetail', function () {
164164
).toBeInTheDocument();
165165
expect(screen.getByRole('button', {name: 'View Query Summary'})).toHaveAttribute(
166166
'href',
167-
'/organizations/org-slug/insights/database/spans/span/a7ebd21614897/?project=2'
167+
'/organizations/org-slug/insights/backend/database/spans/span/a7ebd21614897/?project=2'
168168
);
169169
});
170170
});

static/app/components/events/interfaces/spans/spanSummaryButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface Props {
2323
function SpanSummaryButton(props: Props) {
2424
const location = useLocation();
2525
const resourceBaseUrl = useModuleURL(ModuleName.RESOURCE);
26+
const queryBaseUrl = useModuleURL(ModuleName.DB);
2627

2728
const {event, organization, span} = props;
2829

@@ -41,7 +42,7 @@ function SpanSummaryButton(props: Props) {
4142
<LinkButton
4243
size="xs"
4344
to={querySummaryRouteWithQuery({
44-
orgSlug: organization.slug,
45+
base: queryBaseUrl,
4546
query: location.query,
4647
group: sentryTags.group,
4748
projectID: event.projectID,

static/app/views/performance/transactionSummary/transactionSpans/spanDetails/utils.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,28 @@ export function spanDetailsRouteWithQuery({
5353
}
5454

5555
export function generateQuerySummaryRoute({
56-
orgSlug,
56+
base,
5757
group,
5858
}: {
59+
base: string;
5960
group: string;
60-
orgSlug: string;
6161
}): string {
62-
return `/organizations/${orgSlug}/insights/database/spans/span/${group}/`;
62+
return `${base}/spans/span/${group}/`;
6363
}
6464

6565
export function querySummaryRouteWithQuery({
66-
orgSlug,
66+
base,
6767
query,
6868
group,
6969
projectID,
7070
}: {
71+
base: string;
7172
group: string;
72-
orgSlug: string;
7373
query: Query;
7474
projectID?: string | string[];
7575
}) {
7676
const pathname = generateQuerySummaryRoute({
77-
orgSlug,
77+
base,
7878
group,
7979
});
8080

0 commit comments

Comments
 (0)