Skip to content

Commit 7fc753c

Browse files
authored
ref(insights): Refactor httpDomainSummaryPage to only use useLocationQuery (#89175)
Was poking around in here and decided to do some cleanup before further refactoring
1 parent 6b9a44f commit 7fc753c

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

static/app/views/insights/http/views/httpDomainSummaryPage.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
MutableSearch,
1414
} from 'sentry/utils/tokenizeSearch';
1515
import useLocationQuery from 'sentry/utils/url/useLocationQuery';
16-
import {useLocation} from 'sentry/utils/useLocation';
1716
import useProjects from 'sentry/utils/useProjects';
1817
import {HeaderContainer} from 'sentry/views/insights/common/components/headerContainer';
1918
import {MetricReadout} from 'sentry/views/insights/common/components/metricReadout';
@@ -59,34 +58,27 @@ import {ModuleName, SpanFunction, SpanMetricsField} from 'sentry/views/insights/
5958
import {InsightsLineChartWidget} from '../../common/components/insightsLineChartWidget';
6059
import {useSamplesDrawer} from '../../common/utils/useSamplesDrawer';
6160

62-
type Query = {
63-
aggregate?: string;
64-
domain?: string;
65-
};
66-
6761
export function HTTPDomainSummaryPage() {
68-
const location = useLocation<Query>();
6962
const {projects} = useProjects();
7063
const {view} = useDomainViewFilters();
7164

72-
// TODO: Fetch sort information using `useLocationQuery`
73-
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
74-
const sortField = decodeScalar(location.query?.[QueryParameterNames.TRANSACTIONS_SORT]);
75-
76-
const sort = decodeSorts(sortField).find(isAValidSort) ?? DEFAULT_SORT;
77-
7865
const {
7966
domain,
8067
project: projectId,
81-
'user.geo.subregion': subregions,
68+
[QueryParameterNames.TRANSACTIONS_CURSOR]: cursor,
69+
[QueryParameterNames.TRANSACTIONS_SORT]: sortField,
70+
[SpanMetricsField.USER_GEO_SUBREGION]: subregions,
8271
} = useLocationQuery({
8372
fields: {
8473
project: decodeScalar,
8574
domain: decodeScalar,
75+
[QueryParameterNames.TRANSACTIONS_CURSOR]: decodeScalar,
76+
[QueryParameterNames.TRANSACTIONS_SORT]: decodeScalar,
8677
[SpanMetricsField.USER_GEO_SUBREGION]: decodeList,
8778
transaction: decodeScalar,
8879
},
8980
});
81+
const sort = decodeSorts(sortField).find(isAValidSort) ?? DEFAULT_SORT;
9082

9183
useSamplesDrawer({
9284
Component: <HTTPSamplesPanel />,
@@ -105,9 +97,6 @@ export function HTTPDomainSummaryPage() {
10597
: {}),
10698
};
10799

108-
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
109-
const cursor = decodeScalar(location.query?.[QueryParameterNames.TRANSACTIONS_CURSOR]);
110-
111100
const {data: domainMetrics, isPending: areDomainMetricsLoading} = useSpanMetrics(
112101
{
113102
search: MutableSearch.fromQueryObject(filters),

0 commit comments

Comments
 (0)