Skip to content

Commit

Permalink
Merge pull request #64 from EOEFANS/main
Browse files Browse the repository at this point in the history
修复sentry无法捕获到路由中间的错误。
  • Loading branch information
master1lan authored and GitHub Enterprise committed Apr 4, 2023
2 parents fedf750 + 5f18118 commit 53990f8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
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

0 comments on commit 53990f8

Please sign in to comment.