Skip to content

Commit 35a182e

Browse files
authored
ref(replay): Refactor Replay List&Details so it doesn't depend on deprecatedRouteProps (#96784)
1 parent 0fb8d72 commit 35a182e

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

static/app/routes.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,15 +1728,13 @@ function buildRoutes(): RouteObject[] {
17281728
{
17291729
path: ':replaySlug/',
17301730
component: make(() => import('sentry/views/replays/details')),
1731-
deprecatedRouteProps: true,
17321731
},
17331732
];
17341733
const replayRoutes: SentryRouteObject = {
17351734
path: '/replays/',
17361735
component: make(() => import('sentry/views/replays/index')),
17371736
withOrgPath: true,
17381737
children: replayChildren,
1739-
deprecatedRouteProps: true,
17401738
};
17411739

17421740
const releaseChildren: SentryRouteObject[] = [

static/app/utils/replays/hooks/useInitialTimeOffsetMs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {MutableSearch} from 'sentry/utils/tokenizeSearch';
1010
import useApi from 'sentry/utils/useApi';
1111
import {useLocation} from 'sentry/utils/useLocation';
1212

13-
export type TimeOffsetLocationQueryParams = {
13+
type TimeOffsetLocationQueryParams = {
1414
/**
1515
* The time when the event happened.
1616
* Anything that can be parsed by `new Date()`; for example a timestamp in ms

static/app/utils/useParams.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type ParamKeys =
3535
| 'regionName'
3636
| 'release'
3737
| 'relocationUuid'
38+
| 'replaySlug'
3839
| 'scrubbingId'
3940
| 'searchId'
4041
| 'sentryAppSlug'

static/app/views/replays/details.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import {Fragment} from 'react';
22
import styled from '@emotion/styled';
3+
import invariant from 'invariant';
34

45
import AnalyticsArea from 'sentry/components/analyticsArea';
56
import FullViewport from 'sentry/components/layouts/fullViewport';
67
import * as Layout from 'sentry/components/layouts/thirds';
78
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
89
import {t} from 'sentry/locale';
910
import {space} from 'sentry/styles/space';
10-
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
1111
import {decodeScalar} from 'sentry/utils/queryString';
12-
import type {TimeOffsetLocationQueryParams} from 'sentry/utils/replays/hooks/useInitialTimeOffsetMs';
1312
import useLoadReplayReader from 'sentry/utils/replays/hooks/useLoadReplayReader';
1413
import useReplayPageview from 'sentry/utils/replays/hooks/useReplayPageview';
1514
import useRouteAnalyticsEventNames from 'sentry/utils/routeAnalytics/useRouteAnalyticsEventNames';
1615
import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
1716
import {useLocation} from 'sentry/utils/useLocation';
1817
import useOrganization from 'sentry/utils/useOrganization';
18+
import {useParams} from 'sentry/utils/useParams';
1919
import {useUser} from 'sentry/utils/useUser';
2020
import ReplayDetailsProviders from 'sentry/views/replays/detail/body/replayDetailsProviders';
2121
import ReplayDetailsHeaderActions from 'sentry/views/replays/detail/header/replayDetailsHeaderActions';
@@ -24,16 +24,12 @@ import ReplayDetailsPageBreadcrumbs from 'sentry/views/replays/detail/header/rep
2424
import ReplayDetailsUserBadge from 'sentry/views/replays/detail/header/replayDetailsUserBadge';
2525
import ReplayDetailsPage from 'sentry/views/replays/detail/page';
2626

27-
type Props = RouteComponentProps<
28-
{replaySlug: string},
29-
any,
30-
TimeOffsetLocationQueryParams
31-
>;
32-
33-
export default function ReplayDetails({params: {replaySlug}}: Props) {
27+
export default function ReplayDetails() {
3428
const user = useUser();
3529
const location = useLocation();
3630
const organization = useOrganization();
31+
const {replaySlug} = useParams();
32+
invariant(replaySlug, '`replaySlug` is required as part of the route params');
3733

3834
const {slug: orgSlug} = organization;
3935

static/app/views/replays/index.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
import {Outlet} from 'react-router-dom';
2+
13
import AnalyticsArea from 'sentry/components/analyticsArea';
24
import NoProjectMessage from 'sentry/components/noProjectMessage';
35
import Redirect from 'sentry/components/redirect';
4-
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
56
import useOrganization from 'sentry/utils/useOrganization';
67
import {useRedirectNavV2Routes} from 'sentry/views/nav/useRedirectNavV2Routes';
78

8-
type Props = RouteComponentProps & {
9-
children: React.ReactNode;
10-
};
11-
12-
export default function ReplaysContainer({children}: Props) {
9+
export default function ReplaysContainer() {
1310
const organization = useOrganization();
1411

1512
const redirectPath = useRedirectNavV2Routes({
@@ -23,7 +20,9 @@ export default function ReplaysContainer({children}: Props) {
2320

2421
return (
2522
<AnalyticsArea name="replays">
26-
<NoProjectMessage organization={organization}>{children}</NoProjectMessage>
23+
<NoProjectMessage organization={organization}>
24+
<Outlet />
25+
</NoProjectMessage>
2726
</AnalyticsArea>
2827
);
2928
}

0 commit comments

Comments
 (0)