Skip to content

Commit da15da0

Browse files
ref(browserHistory): Remove from organizationCrumb (#82714)
1 parent aa73ba5 commit da15da0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

static/app/views/settings/components/settingsBreadcrumb/organizationCrumb.spec.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('OrganizationCrumb', function () {
6565
renderComponent({routes, route});
6666
await switchOrganization();
6767

68-
expect(router.push).toHaveBeenCalledWith('/settings/org-slug2/');
68+
expect(router.push).toHaveBeenCalledWith({pathname: '/settings/org-slug2/'});
6969
});
7070

7171
it('switches organizations while on API Keys Details route', async function () {
@@ -86,7 +86,7 @@ describe('OrganizationCrumb', function () {
8686
renderComponent({routes, route});
8787
await switchOrganization();
8888

89-
expect(router.push).toHaveBeenCalledWith('/settings/org-slug2/api-keys/');
89+
expect(router.push).toHaveBeenCalledWith({pathname: '/settings/org-slug2/api-keys/'});
9090
});
9191

9292
it('switches organizations while on API Keys List route', async function () {
@@ -106,7 +106,7 @@ describe('OrganizationCrumb', function () {
106106
renderComponent({routes, route});
107107
await switchOrganization();
108108

109-
expect(router.push).toHaveBeenCalledWith('/settings/org-slug2/api-keys/');
109+
expect(router.push).toHaveBeenCalledWith({pathname: '/settings/org-slug2/api-keys/'});
110110
});
111111

112112
it('switches organizations while in Project Client Keys Details route', async function () {
@@ -128,7 +128,7 @@ describe('OrganizationCrumb', function () {
128128
});
129129
await switchOrganization();
130130

131-
expect(router.push).toHaveBeenCalledWith('/settings/org-slug2/');
131+
expect(router.push).toHaveBeenCalledWith({pathname: '/settings/org-slug2/'});
132132
});
133133

134134
it('switches organizations for child route with customer domains', async function () {

static/app/views/settings/components/settingsBreadcrumb/organizationCrumb.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import OrganizationsStore from 'sentry/stores/organizationsStore';
66
import {useLegacyStore} from 'sentry/stores/useLegacyStore';
77
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
88
import type {Organization} from 'sentry/types/organization';
9-
import {browserHistory} from 'sentry/utils/browserHistory';
109
import recreateRoute from 'sentry/utils/recreateRoute';
1110
import {resolveRoute} from 'sentry/utils/resolveRoute';
11+
import {useNavigate} from 'sentry/utils/useNavigate';
1212
import useOrganization from 'sentry/utils/useOrganization';
1313

1414
import BreadcrumbDropdown from './breadcrumbDropdown';
@@ -19,6 +19,7 @@ import {CrumbLink} from '.';
1919
type Props = RouteComponentProps<{projectId?: string}, {}>;
2020

2121
function OrganizationCrumb({params, routes, route, ...props}: Props) {
22+
const navigate = useNavigate();
2223
const {organizations} = useLegacyStore(OrganizationsStore);
2324
const organization = useOrganization();
2425

@@ -53,7 +54,7 @@ function OrganizationCrumb({params, routes, route, ...props}: Props) {
5354
if (resolvedUrl.startsWith('http')) {
5455
window.location.assign(resolvedUrl);
5556
} else {
56-
browserHistory.push(resolvedUrl);
57+
navigate(resolvedUrl);
5758
}
5859
};
5960

0 commit comments

Comments
 (0)