Skip to content

Commit 5f58b5c

Browse files
evanpurkhiserandrewshie-sentry
authored andcommitted
ref(js): Remove browserHistory from gsAdmin home (#88768)
1 parent 9aa74bb commit 5f58b5c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

static/gsAdmin/views/home.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,25 @@ import {t} from 'sentry/locale';
99
import ConfigStore from 'sentry/stores/configStore';
1010
import {space} from 'sentry/styles/space';
1111
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
12-
import {browserHistory} from 'sentry/utils/browserHistory';
12+
import {useNavigate} from 'sentry/utils/useNavigate';
1313

1414
import DebounceSearch from 'admin/components/debounceSearch';
1515
import Overview from 'admin/views/overview';
1616

1717
type Props = RouteComponentProps<unknown, unknown>;
1818

1919
function HomePage(props: Props) {
20+
const navigate = useNavigate();
2021
const regions = ConfigStore.get('regions');
2122
const [oldSplash, setOldSplash] = useState(false);
2223
const [regionUrl, setRegionUrl] = useState(regions[0]!.url);
2324

2425
const buildOrgPath = (org: any) => `/_admin/customers/${org.slug}/`;
2526
const orgSelect = (org: any) => {
26-
browserHistory.push(buildOrgPath(org));
27+
navigate(buildOrgPath(org));
2728
};
2829
const orgSubmit = (query: string) => {
29-
browserHistory.push({
30+
navigate({
3031
pathname: '/_admin/customers/',
3132
query: {
3233
query,
@@ -35,10 +36,10 @@ function HomePage(props: Props) {
3536
};
3637
const buildUserPath = (user: any) => `/_admin/users/${user.id}/`;
3738
const userSelect = (user: any) => {
38-
browserHistory.push(buildUserPath(user));
39+
navigate(buildUserPath(user));
3940
};
4041
const userSubmit = (query: string) => {
41-
browserHistory.push({
42+
navigate({
4243
pathname: '/_admin/users/',
4344
query: {
4445
query,
@@ -48,7 +49,7 @@ function HomePage(props: Props) {
4849
const buildProjPath = (proj: any) =>
4950
`/_admin/customers/${proj.organization.slug}/projects/${proj.slug}/`;
5051
const projSelect = (proj: any) => {
51-
browserHistory.push(buildProjPath(proj));
52+
navigate(buildProjPath(proj));
5253
};
5354

5455
const renderOrgSuggestion = (org: any) => {

0 commit comments

Comments
 (0)