diff --git a/.changeset/orange-poems-beam.md b/.changeset/orange-poems-beam.md new file mode 100644 index 0000000000..6c34144f14 --- /dev/null +++ b/.changeset/orange-poems-beam.md @@ -0,0 +1,5 @@ +--- +"@venusprotocol/evm": patch +--- + +Prevent sending errors from old releases diff --git a/apps/evm/package.json b/apps/evm/package.json index 46ffb8bf91..c7b6add62b 100644 --- a/apps/evm/package.json +++ b/apps/evm/package.json @@ -9,7 +9,7 @@ "start": "vite", "build": "NODE_OPTIONS=\"--max-old-space-size=16384\" && vite build", "serve": "vite preview", - "test": "TZ=UTC VITE_NETWORK=testnet vitest run", + "test": "TZ=UTC VITE_NETWORK=testnet VITE_ENV=ci vitest run", "test:regression": "reg-suit run", "clean": "rm -rf .turbo && rm -rf node_modules", "lint": "yarn lint:styles && biome check . --diagnostic-level=error", @@ -157,15 +157,7 @@ "whatwg-fetch": "^3.6.18" }, "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] + "production": [">0.2%", "not dead", "not op_mini all"], + "development": ["last 1 chrome version", "last 1 firefox version", "last 1 safari version"] } } diff --git a/apps/evm/src/App/index.tsx b/apps/evm/src/App/index.tsx index e3fa2f5598..625f93f3bf 100644 --- a/apps/evm/src/App/index.tsx +++ b/apps/evm/src/App/index.tsx @@ -33,10 +33,10 @@ const App = () => ( ) } - - - - + + + + @@ -60,10 +60,10 @@ const App = () => ( - - - - + + + + ); diff --git a/apps/evm/src/libs/errors/ErrorBoundary/index.tsx b/apps/evm/src/libs/errors/ErrorBoundary/index.tsx index c3c41dcb05..5773f9a4cf 100644 --- a/apps/evm/src/libs/errors/ErrorBoundary/index.tsx +++ b/apps/evm/src/libs/errors/ErrorBoundary/index.tsx @@ -1,4 +1,6 @@ import * as Sentry from '@sentry/react'; +import useGetLatestAppVersion from 'clients/api/queries/getLatestAppVersion/useGetLatestAppVersion'; +import { compareVersions } from 'compare-versions'; import config from 'config'; import { version as APP_VERSION } from 'constants/version'; @@ -21,6 +23,22 @@ Sentry.init({ ], }); -export const ErrorBoundary: React.FC = ({ children }) => ( - {children} -); +export const ErrorBoundary: React.FC = ({ children }) => { + const { data } = useGetLatestAppVersion(); + const latestAppVersion = data?.version; + + return ( + { + // Prevent sending errors from old releases + if (latestAppVersion && compareVersions(latestAppVersion, APP_VERSION)) { + return undefined; + } + + return e; + }} + > + {children} + + ); +}; diff --git a/apps/evm/src/libs/errors/logError.ts b/apps/evm/src/libs/errors/logError.ts index 4a8c47b033..bb5d99e448 100644 --- a/apps/evm/src/libs/errors/logError.ts +++ b/apps/evm/src/libs/errors/logError.ts @@ -3,8 +3,8 @@ import * as Sentry from '@sentry/react'; import config from 'config'; export const logError = (error: string | unknown) => { - // Only send errors to Sentry in hosted environments - if (config.environment !== 'preview' && config.environment !== 'production') { + // Only send errors to Sentry in production + if (config.environment !== 'production') { console.error(`[Logger]: ${error}`); return; }