Skip to content

Commit 250ec89

Browse files
committed
Remove browserHistory usage from performance landing utils
1 parent 275aa80 commit 250ec89

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

static/app/views/performance/landing/utils.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import type {Location} from 'history';
22

33
import {t} from 'sentry/locale';
44
import type {Project} from 'sentry/types/project';
5-
import {browserHistory} from 'sentry/utils/browserHistory';
65
import type {EventView} from 'sentry/utils/discover/eventView';
76
import {decodeScalar} from 'sentry/utils/queryString';
87
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
8+
import type {ReactRouter3Navigate} from 'sentry/utils/useNavigate';
99
import {
1010
platformToPerformanceType,
1111
ProjectPerformanceType,
@@ -47,14 +47,14 @@ const LANDING_DISPLAYS = [
4747

4848
export function excludeTransaction(
4949
transaction: string | number,
50-
props: {eventView: EventView; location: Location}
50+
props: {eventView: EventView; location: Location; navigate: ReactRouter3Navigate}
5151
) {
52-
const {eventView, location} = props;
52+
const {eventView, location, navigate} = props;
5353

5454
const searchConditions = new MutableSearch(eventView.query);
5555
searchConditions.addFilterValues('!transaction', [`${transaction}`]);
5656

57-
browserHistory.push({
57+
navigate({
5858
pathname: location.pathname,
5959
query: {
6060
...location.query,

static/app/views/performance/landing/widgets/widgets/lineChartListWidget.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {usePageAlert} from 'sentry/utils/performance/contexts/pageAlert';
2525
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
2626
import {normalizeUrl} from 'sentry/utils/url/normalizeUrl';
2727
import {useLocation} from 'sentry/utils/useLocation';
28+
import {useNavigate} from 'sentry/utils/useNavigate';
2829
import {withApi} from 'sentry/utils/withApi';
2930
import {getResourcesEventViewQuery} from 'sentry/views/insights/browser/common/queries/useResourcesQuery';
3031
import {DEFAULT_RESOURCE_TYPES} from 'sentry/views/insights/browser/resources/settings';
@@ -105,6 +106,7 @@ const integrationEmptyStateWidgets = [
105106

106107
export function LineChartListWidget(props: PerformanceWidgetProps) {
107108
const location = useLocation();
109+
const navigate = useNavigate();
108110
const mepSetting = useMEPSettingContext();
109111
const [selectedListIndex, setSelectListIndex] = useState<number>(0);
110112
const {organization, InteractiveTitle} = props;
@@ -618,6 +620,7 @@ export function LineChartListWidget(props: PerformanceWidgetProps) {
618620
excludeTransaction(listItem.transaction!, {
619621
eventView: props.eventView,
620622
location,
623+
navigate,
621624
})
622625
}
623626
/>
@@ -642,6 +645,7 @@ export function LineChartListWidget(props: PerformanceWidgetProps) {
642645
excludeTransaction(listItem.transaction!, {
643646
eventView: props.eventView,
644647
location,
648+
navigate,
645649
})
646650
}
647651
/>
@@ -673,6 +677,7 @@ export function LineChartListWidget(props: PerformanceWidgetProps) {
673677
excludeTransaction(listItem.transaction!, {
674678
eventView: props.eventView,
675679
location,
680+
navigate,
676681
})
677682
}
678683
/>
@@ -717,6 +722,7 @@ export function LineChartListWidget(props: PerformanceWidgetProps) {
717722
excludeTransaction(listItem.transaction!, {
718723
eventView: props.eventView,
719724
location,
725+
navigate,
720726
})
721727
}
722728
/>
@@ -745,6 +751,7 @@ export function LineChartListWidget(props: PerformanceWidgetProps) {
745751
excludeTransaction(listItem.transaction!, {
746752
eventView: props.eventView,
747753
location,
754+
navigate,
748755
})
749756
}
750757
/>
@@ -769,6 +776,7 @@ export function LineChartListWidget(props: PerformanceWidgetProps) {
769776
excludeTransaction(listItem.transaction!, {
770777
eventView: props.eventView,
771778
location,
779+
navigate,
772780
})
773781
}
774782
/>
@@ -789,6 +797,7 @@ export function LineChartListWidget(props: PerformanceWidgetProps) {
789797
excludeTransaction(listItem.transaction!, {
790798
eventView: props.eventView,
791799
location,
800+
navigate,
792801
})
793802
}
794803
/>

static/app/views/performance/landing/widgets/widgets/trendsWidget.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {useMetricsCardinalityContext} from 'sentry/utils/performance/contexts/me
77
import {TrendsDiscoverQuery} from 'sentry/utils/performance/trends/trendsDiscoverQuery';
88
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
99
import {useLocation} from 'sentry/utils/useLocation';
10+
import {useNavigate} from 'sentry/utils/useNavigate';
1011
import {useProjects} from 'sentry/utils/useProjects';
1112
import {withProjects} from 'sentry/utils/withProjects';
1213
import {excludeTransaction} from 'sentry/views/performance/landing/utils';
@@ -52,6 +53,7 @@ const fields = [{field: 'transaction'}, {field: 'project'}];
5253

5354
export function TrendsWidget(props: PerformanceWidgetProps) {
5455
const location = useLocation();
56+
const navigate = useNavigate();
5557
const {projects} = useProjects();
5658

5759
const {isLoading: isCardinalityCheckLoading, outcome} = useMetricsCardinalityContext();
@@ -180,6 +182,7 @@ export function TrendsWidget(props: PerformanceWidgetProps) {
180182
excludeTransaction(listItem.transaction, {
181183
eventView: props.eventView,
182184
location,
185+
navigate,
183186
})
184187
}
185188
/>

0 commit comments

Comments
 (0)