-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathindex.tsx
73 lines (64 loc) · 1.88 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import * as Sentry from '@sentry/react';
import React from 'react';
import ReactDOM from 'react-dom/client';
import {
BrowserRouter,
Route,
Routes,
createRoutesFromChildren,
matchRoutes,
useLocation,
useNavigationType,
} from 'react-router-dom';
import Index from './pages/Index';
const replay = Sentry.replayIntegration();
Sentry.init({
environment: 'qa', // dynamic sampling bias to keep transactions
dsn: process.env.REACT_APP_E2E_TEST_DSN,
integrations: [
Sentry.reactRouterV6BrowserTracingIntegration({
useEffect: React.useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes,
trackFetchStreamPerformance: true,
}),
replay,
],
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,
release: 'e2e-test',
// Always capture replays, so we can test this properly
replaysSessionSampleRate: 1.0,
replaysOnErrorSampleRate: 0.0,
tunnel: 'http://localhost:3031',
});
const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes);
const DetailsRoutes = () => (
<SentryRoutes>
<Route path=":detailId" element={<div id="details">Details</div>} />
</SentryRoutes>
);
const ViewsRoutes = () => (
<SentryRoutes>
<Route index element={<div id="views">Views</div>} />
<Route path="views/:viewId/*" element={<DetailsRoutes />} />
</SentryRoutes>
);
const ProjectsRoutes = () => (
<SentryRoutes>
<Route path="projects/:projectId/*" element={<ViewsRoutes />}></Route>
<Route path="*" element={<div>No Match Page</div>} />
</SentryRoutes>
);
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
<BrowserRouter>
<SentryRoutes>
<Route path="/" element={<Index />} />
<Route path="/*" element={<ProjectsRoutes />}></Route>
</SentryRoutes>
</BrowserRouter>,
);