Skip to content

修复sentry无法捕获到路由中间的错误。 #64

Merged
merged 2 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## 1.4.1 (2023-04-04)


### 🐛 Bug Fixes

* **custom**: 修复sentry无法捕获到路由的错误 ([6003529](https://vlink.dev/EOEFANS/eoefans-web/commits/6003529))



# 1.4.0 (2023-03-31)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eoefans-web",
"version": "1.4.0",
"version": "1.4.1",
"type": "module",
"scripts": {
"dev": "vite --config ./config/vite.dev.config.ts",
Expand Down
26 changes: 22 additions & 4 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import ReactDOM from "react-dom/client";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import {
createBrowserRouter,
createRoutesFromChildren,
matchRoutes,
RouterProvider,
useLocation,
useNavigationType,
} from "react-router-dom";
//router page
import VideoPage from "./routers/video";
import Layout from "./routers/layout";
Expand All @@ -23,6 +30,7 @@ import * as Sentry from "@sentry/react";
import { BrowserTracing } from "@sentry/tracing";
import SearchPage, { loader as SearchLoader } from "@routers/search";
import { RecoilRoot } from "recoil";
import React from "react";
if (!isdev && isrelease) {
Sentry.init({
dsn: "https://086f27258cce4d28aacc8c2719a683fb@sentry.vtb.link/3",
Expand All @@ -33,7 +41,15 @@ if (!isdev && isrelease) {
return event;
},
integrations: [
new BrowserTracing(),
new BrowserTracing({
routingInstrumentation: Sentry.reactRouterV6Instrumentation(
React.useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes
),
}),
new Sentry.Replay({
// Additional SDK configuration goes in here, for example:
maskAllText: true,
Expand All @@ -44,13 +60,15 @@ if (!isdev && isrelease) {
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 0.5,
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
}
const sentryCreateBrowserRouter =
Sentry.wrapCreateBrowserRouter(createBrowserRouter);

const router = createBrowserRouter([
const router = sentryCreateBrowserRouter([
{
path: "/",
element: <Layout />,
Expand Down