diff --git a/.env b/.env index a8ef16088f..275c253d7a 100644 --- a/.env +++ b/.env @@ -3,6 +3,11 @@ COINGECKO_API_KEY="" # Minutes to cache prices for token addresses TOKEN_PRICE_CACHE_INTERVAL_MINUTES="" +# Configuration for Netlify Sentry plugin, not needed in development +SENTRY_ORG="" +SENTRY_PROJECT="" +SENTRY_AUTH_TOKEN="" + # App name displayed as Title VITE_APP_NAME="Fractal" diff --git a/package-lock.json b/package-lock.json index 1227202c32..94f2528e5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@safe-global/safe-deployments": "^1.34.0", "@safe-global/safe-ethers-lib": "^1.9.2", "@safe-global/safe-service-client": "^1.5.2", - "@sentry/react": "^7.104.0", + "@sentry/react": "^7.112.2", "@shutter-network/shutter-crypto": "^1.0.1", "@snapshot-labs/snapshot.js": "^0.7.3", "@tanstack/react-query": "^5.28.4", @@ -10402,181 +10402,70 @@ "peer": true }, "node_modules/@sentry-internal/feedback": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.104.0.tgz", - "integrity": "sha512-+OWqm+X9ZfEQQmxVoZsc9lpzd85pabAT+bEj57StRMTnfdRbD9TippS20nCD9N2Ql5v2/41NfiPONMejGbnOwg==", + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.112.2.tgz", + "integrity": "sha512-z+XP8BwB8B3pa+i8xqbrPsbtDWUFUS6wo+FJbmOYUqOusJJbVFDAhBoEdKoo5ZjOcsAZG7XR6cA9zrhJynIWBA==", "dependencies": { - "@sentry/core": "7.104.0", - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" + "@sentry/core": "7.112.2", + "@sentry/types": "7.112.2", + "@sentry/utils": "7.112.2" }, "engines": { "node": ">=12" } }, - "node_modules/@sentry-internal/feedback/node_modules/@sentry/core": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.104.0.tgz", - "integrity": "sha512-XPndD6IGQGd07/EntvYVzOWQUo/Gd7L3DwYFeEKeBv6ByWjbBNmVZFRhU0GPPsCHKyW9yMU9OO9diLSS4ijsRg==", - "dependencies": { - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/feedback/node_modules/@sentry/types": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.104.0.tgz", - "integrity": "sha512-5bs0xe0+GZR4QBm9Nrqw59o0sv3kBtCosrZDVxBru/dQbrfnB+/kVorvuM0rV3+coNITTKcKDegSZmK1d2uOGQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/feedback/node_modules/@sentry/utils": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.104.0.tgz", - "integrity": "sha512-ZVg+xZirI9DlOi0NegNVocswdh/8p6QkzlQzDQY2LP2CC6JQdmwi64o0S4rPH4YIHNKQJTpIjduoxeKgd1EO5g==", - "dependencies": { - "@sentry/types": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@sentry-internal/replay-canvas": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-7.104.0.tgz", - "integrity": "sha512-gfdnkFIpxAveKNghkvRCqv+hSiBkxYVoyFZLTvUPuM9Cmvmket1/PpnuWMC2jNtCEewG3gxkPDd4EaT9oa1HZQ==", + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-7.112.2.tgz", + "integrity": "sha512-BCCCxrZ1wJvN6La5gg1JJbKitAhJI5MATCnhtklsZbUcHkHB9iZoj19J65+P56gwssvHz5xh63AjNiITaetIRg==", "dependencies": { - "@sentry/core": "7.104.0", - "@sentry/replay": "7.104.0", - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" + "@sentry/core": "7.112.2", + "@sentry/replay": "7.112.2", + "@sentry/types": "7.112.2", + "@sentry/utils": "7.112.2" }, "engines": { "node": ">=12" } }, - "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/core": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.104.0.tgz", - "integrity": "sha512-XPndD6IGQGd07/EntvYVzOWQUo/Gd7L3DwYFeEKeBv6ByWjbBNmVZFRhU0GPPsCHKyW9yMU9OO9diLSS4ijsRg==", - "dependencies": { - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/types": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.104.0.tgz", - "integrity": "sha512-5bs0xe0+GZR4QBm9Nrqw59o0sv3kBtCosrZDVxBru/dQbrfnB+/kVorvuM0rV3+coNITTKcKDegSZmK1d2uOGQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/utils": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.104.0.tgz", - "integrity": "sha512-ZVg+xZirI9DlOi0NegNVocswdh/8p6QkzlQzDQY2LP2CC6JQdmwi64o0S4rPH4YIHNKQJTpIjduoxeKgd1EO5g==", - "dependencies": { - "@sentry/types": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@sentry-internal/tracing": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.104.0.tgz", - "integrity": "sha512-2z7OijM1J5ndJUiJJElC3iH9qb/Eb8eYm2v8oJhM8WVdc5uCKfrQuYHNgGOnmY2FOCfEUlTmMQGpDw7DJ67L5w==", - "dependencies": { - "@sentry/core": "7.104.0", - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/tracing/node_modules/@sentry/core": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.104.0.tgz", - "integrity": "sha512-XPndD6IGQGd07/EntvYVzOWQUo/Gd7L3DwYFeEKeBv6ByWjbBNmVZFRhU0GPPsCHKyW9yMU9OO9diLSS4ijsRg==", + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.112.2.tgz", + "integrity": "sha512-fT1Y46J4lfXZkgFkb03YMNeIEs2xS6jdKMoukMFQfRfVvL9fSWEbTgZpHPd/YTT8r2i082XzjtAoQNgklm/0Hw==", "dependencies": { - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/tracing/node_modules/@sentry/types": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.104.0.tgz", - "integrity": "sha512-5bs0xe0+GZR4QBm9Nrqw59o0sv3kBtCosrZDVxBru/dQbrfnB+/kVorvuM0rV3+coNITTKcKDegSZmK1d2uOGQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/tracing/node_modules/@sentry/utils": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.104.0.tgz", - "integrity": "sha512-ZVg+xZirI9DlOi0NegNVocswdh/8p6QkzlQzDQY2LP2CC6JQdmwi64o0S4rPH4YIHNKQJTpIjduoxeKgd1EO5g==", - "dependencies": { - "@sentry/types": "7.104.0" + "@sentry/core": "7.112.2", + "@sentry/types": "7.112.2", + "@sentry/utils": "7.112.2" }, "engines": { "node": ">=8" } }, "node_modules/@sentry/browser": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.104.0.tgz", - "integrity": "sha512-HsqO+mr1SowGoP0VbuWrQ2DZT0t5PLomy7LEYa6+4lbOemnY+5YV2NSwBTKbjYysvKipSwaRtPhXrsXsMaz8Bg==", + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.112.2.tgz", + "integrity": "sha512-wULwavCch84+d0bueAdFm6CDm1u0TfOjN91VgY+sj/vxUV2vesvDgI8zRZfmbZEor3MYA90zerkZT3ehZQKbYw==", "dependencies": { - "@sentry-internal/feedback": "7.104.0", - "@sentry-internal/replay-canvas": "7.104.0", - "@sentry-internal/tracing": "7.104.0", - "@sentry/core": "7.104.0", - "@sentry/replay": "7.104.0", - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" + "@sentry-internal/feedback": "7.112.2", + "@sentry-internal/replay-canvas": "7.112.2", + "@sentry-internal/tracing": "7.112.2", + "@sentry/core": "7.112.2", + "@sentry/integrations": "7.112.2", + "@sentry/replay": "7.112.2", + "@sentry/types": "7.112.2", + "@sentry/utils": "7.112.2" }, "engines": { "node": ">=8" } }, - "node_modules/@sentry/browser/node_modules/@sentry/core": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.104.0.tgz", - "integrity": "sha512-XPndD6IGQGd07/EntvYVzOWQUo/Gd7L3DwYFeEKeBv6ByWjbBNmVZFRhU0GPPsCHKyW9yMU9OO9diLSS4ijsRg==", - "dependencies": { - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/browser/node_modules/@sentry/types": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.104.0.tgz", - "integrity": "sha512-5bs0xe0+GZR4QBm9Nrqw59o0sv3kBtCosrZDVxBru/dQbrfnB+/kVorvuM0rV3+coNITTKcKDegSZmK1d2uOGQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/browser/node_modules/@sentry/utils": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.104.0.tgz", - "integrity": "sha512-ZVg+xZirI9DlOi0NegNVocswdh/8p6QkzlQzDQY2LP2CC6JQdmwi64o0S4rPH4YIHNKQJTpIjduoxeKgd1EO5g==", + "node_modules/@sentry/core": { + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.112.2.tgz", + "integrity": "sha512-gHPCcJobbMkk0VR18J65WYQTt3ED4qC6X9lHKp27Ddt63E+MDGkG6lvYBU1LS8cV7CdyBGC1XXDCfor61GvLsA==", "dependencies": { - "@sentry/types": "7.104.0" + "@sentry/types": "7.112.2", + "@sentry/utils": "7.112.2" }, "engines": { "node": ">=8" @@ -10624,6 +10513,20 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "peer": true }, + "node_modules/@sentry/integrations": { + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.112.2.tgz", + "integrity": "sha512-ioC2yyU6DqtLkdmWnm87oNvdn2+9oKctJeA4t+jkS6JaJ10DcezjCwiLscX4rhB9aWJV3IWF7Op0O6K3w0t2Hg==", + "dependencies": { + "@sentry/core": "7.112.2", + "@sentry/types": "7.112.2", + "@sentry/utils": "7.112.2", + "localforage": "^1.8.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@sentry/minimal": { "version": "5.30.0", "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.30.0.tgz", @@ -10734,14 +10637,14 @@ "peer": true }, "node_modules/@sentry/react": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.104.0.tgz", - "integrity": "sha512-JdPzX/rJ4sSr/pVFOKwVrUhr8McCn38w5Q+/wdCabO8fdUkoBe4P05LRCH4Rng0uOk8MeEQ+EvfMVB79DmxIgQ==", - "dependencies": { - "@sentry/browser": "7.104.0", - "@sentry/core": "7.104.0", - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0", + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.112.2.tgz", + "integrity": "sha512-Xf6mc1+/ncCk6ZFIj0oT4or2o0UxqqJZk09U/21RYNvVCn7+DNyCdJZ/F5wXWgPqVE67PrjydLLYaQWiqLibiA==", + "dependencies": { + "@sentry/browser": "7.112.2", + "@sentry/core": "7.112.2", + "@sentry/types": "7.112.2", + "@sentry/utils": "7.112.2", "hoist-non-react-statics": "^3.3.2" }, "engines": { @@ -10751,77 +10654,34 @@ "react": "15.x || 16.x || 17.x || 18.x" } }, - "node_modules/@sentry/react/node_modules/@sentry/core": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.104.0.tgz", - "integrity": "sha512-XPndD6IGQGd07/EntvYVzOWQUo/Gd7L3DwYFeEKeBv6ByWjbBNmVZFRhU0GPPsCHKyW9yMU9OO9diLSS4ijsRg==", - "dependencies": { - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/react/node_modules/@sentry/types": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.104.0.tgz", - "integrity": "sha512-5bs0xe0+GZR4QBm9Nrqw59o0sv3kBtCosrZDVxBru/dQbrfnB+/kVorvuM0rV3+coNITTKcKDegSZmK1d2uOGQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/react/node_modules/@sentry/utils": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.104.0.tgz", - "integrity": "sha512-ZVg+xZirI9DlOi0NegNVocswdh/8p6QkzlQzDQY2LP2CC6JQdmwi64o0S4rPH4YIHNKQJTpIjduoxeKgd1EO5g==", - "dependencies": { - "@sentry/types": "7.104.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@sentry/replay": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.104.0.tgz", - "integrity": "sha512-HmWBr/u+SNeULxCxM8lJb2iqhjizeLGJtuKSShPEguEXIUT4kzdoqLh6wn7BAjiKzhmyjrnBcosR5LUqJtGYZQ==", + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.112.2.tgz", + "integrity": "sha512-7Ns/8D54WPsht1nlVj93Inf6rXyve2AZoibYN0YfcM2w3lI4NO51gPPHJU0lFEfMwzwK4ZBJWzOeW9098a+uEg==", "dependencies": { - "@sentry-internal/tracing": "7.104.0", - "@sentry/core": "7.104.0", - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" + "@sentry-internal/tracing": "7.112.2", + "@sentry/core": "7.112.2", + "@sentry/types": "7.112.2", + "@sentry/utils": "7.112.2" }, "engines": { "node": ">=12" } }, - "node_modules/@sentry/replay/node_modules/@sentry/core": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.104.0.tgz", - "integrity": "sha512-XPndD6IGQGd07/EntvYVzOWQUo/Gd7L3DwYFeEKeBv6ByWjbBNmVZFRhU0GPPsCHKyW9yMU9OO9diLSS4ijsRg==", - "dependencies": { - "@sentry/types": "7.104.0", - "@sentry/utils": "7.104.0" - }, + "node_modules/@sentry/types": { + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.112.2.tgz", + "integrity": "sha512-kCMLt7yhY5OkWE9MeowlTNmox9pqDxcpvqguMo4BDNZM5+v9SEb1AauAdR78E1a1V8TyCzjBD7JDfXWhvpYBcQ==", "engines": { "node": ">=8" } }, - "node_modules/@sentry/replay/node_modules/@sentry/types": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.104.0.tgz", - "integrity": "sha512-5bs0xe0+GZR4QBm9Nrqw59o0sv3kBtCosrZDVxBru/dQbrfnB+/kVorvuM0rV3+coNITTKcKDegSZmK1d2uOGQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/replay/node_modules/@sentry/utils": { - "version": "7.104.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.104.0.tgz", - "integrity": "sha512-ZVg+xZirI9DlOi0NegNVocswdh/8p6QkzlQzDQY2LP2CC6JQdmwi64o0S4rPH4YIHNKQJTpIjduoxeKgd1EO5g==", + "node_modules/@sentry/utils": { + "version": "7.112.2", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.112.2.tgz", + "integrity": "sha512-OjLh0hx0t1EcL4ZIjf+4svlmmP+tHUDGcr5qpFWH78tjmkPW4+cqPuZCZfHSuWcDdeiaXi8TnYoVRqDcJKK/eQ==", "dependencies": { - "@sentry/types": "7.104.0" + "@sentry/types": "7.112.2" }, "engines": { "node": ">=8" @@ -18979,8 +18839,7 @@ "node_modules/immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", - "dev": true + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" }, "node_modules/immer": { "version": "9.0.21", @@ -20846,7 +20705,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", - "dev": true, "dependencies": { "immediate": "~3.0.5" } @@ -20933,7 +20791,6 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", - "dev": true, "dependencies": { "lie": "3.1.1" } @@ -21115,9 +20972,9 @@ } }, "node_modules/magic-string": { - "version": "0.30.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.7.tgz", - "integrity": "sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA==", + "version": "0.30.8", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", + "integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==", "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, diff --git a/package.json b/package.json index 9175d797b3..b329fa266f 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@safe-global/safe-deployments": "^1.34.0", "@safe-global/safe-ethers-lib": "^1.9.2", "@safe-global/safe-service-client": "^1.5.2", - "@sentry/react": "^7.104.0", + "@sentry/react": "^7.112.2", "@shutter-network/shutter-crypto": "^1.0.1", "@snapshot-labs/snapshot.js": "^0.7.3", "@tanstack/react-query": "^5.28.4", @@ -63,7 +63,7 @@ "dev": "VITE_APP_GIT_HASH=`git rev-parse HEAD` vite --force", "start": "vite start", "preview": "vite preview", - "build": "VITE_APP_GIT_HASH=`git rev-parse HEAD` vite build", + "build": "VITE_APP_GIT_HASH=`git rev-parse HEAD` NODE_OPTIONS=--max-old-space-size=8192 vite build", "graphql:build": "graphclient build", "graphql:dev-server": "graphclient serve-dev", "test": "vitest --dir=test", diff --git a/src/components/ui/page/Layout/index.tsx b/src/components/ui/page/Layout/index.tsx index d267c0f34f..4fb69f7ef7 100644 --- a/src/components/ui/page/Layout/index.tsx +++ b/src/components/ui/page/Layout/index.tsx @@ -1,6 +1,8 @@ import { Box, Container, Grid, GridItem } from '@chakra-ui/react'; import { Outlet } from 'react-router-dom'; import { CONTENT_HEIGHT, HEADER_HEIGHT } from '../../../../constants/common'; +import { ErrorBoundary } from '../../utils/ErrorBoundary'; +import { TopErrorFallback } from '../../utils/TopErrorFallback'; import Header from '../Header'; import Navigation from '../Navigation'; @@ -28,7 +30,12 @@ export default function Layout() { minH={CONTENT_HEIGHT} paddingBottom="2rem" > - + } + showDialog + > + + diff --git a/src/components/ui/utils/ErrorBoundary.tsx b/src/components/ui/utils/ErrorBoundary.tsx new file mode 100644 index 0000000000..4fdf1ff1b8 --- /dev/null +++ b/src/components/ui/utils/ErrorBoundary.tsx @@ -0,0 +1,21 @@ +import * as Sentry from '@sentry/react'; +import { JSXElementConstructor, ReactElement } from 'react'; + +export function ErrorBoundary({ + children, + fallback, + showDialog, +}: { + children: React.ReactNode; + fallback?: ReactElement> | Sentry.FallbackRender; + showDialog?: boolean; +}) { + return ( + + {children} + + ); +} diff --git a/src/components/ui/utils/ErrorFallback.tsx b/src/components/ui/utils/TopErrorFallback.tsx similarity index 83% rename from src/components/ui/utils/ErrorFallback.tsx rename to src/components/ui/utils/TopErrorFallback.tsx index 5eb5c5cdcb..3b6d03f8dc 100644 --- a/src/components/ui/utils/ErrorFallback.tsx +++ b/src/components/ui/utils/TopErrorFallback.tsx @@ -3,14 +3,20 @@ import { Alert } from '@decent-org/fractal-ui'; import { Trans, useTranslation } from 'react-i18next'; import { CONTENT_HEIGHT } from '../../../constants/common'; import { URL_DISCORD } from '../../../constants/url'; -import { InfoBox } from '../containers/InfoBox'; -export function ErrorFallback() { +export function TopErrorFallback() { const { t } = useTranslation(); return (
- + - +
); diff --git a/src/helpers/errorLogging.ts b/src/helpers/errorLogging.ts index 0306b12caa..e9ac12332f 100644 --- a/src/helpers/errorLogging.ts +++ b/src/helpers/errorLogging.ts @@ -1,19 +1,31 @@ import * as Sentry from '@sentry/react'; +import { useEffect } from 'react'; +import { + useLocation, + useNavigationType, + createRoutesFromChildren, + matchRoutes, +} from 'react-router-dom'; /** * Initializes error logging. */ function initErrorLogging() { - if ( - process.env.NODE_ENV === 'development' || - import.meta.env.VITE_APP_SENTRY_DSN_URL === undefined - ) { - return; - } - Sentry.init({ dsn: import.meta.env.VITE_APP_SENTRY_DSN_URL, - integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()], + integrations: [ + Sentry.reactRouterV6BrowserTracingIntegration({ + useEffect, + useLocation, + useNavigationType, + createRoutesFromChildren, + matchRoutes, + }), + Sentry.replayIntegration(), + Sentry.feedbackIntegration({ + colorScheme: 'dark', + }), + ], // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. @@ -36,27 +48,9 @@ initErrorLogging(); */ export function logError(error: any, ...optionalParams: any[]) { console.error(error, optionalParams); - if (process.env.NODE_ENV === 'development') return; if (typeof error === 'string' || error instanceof String) { Sentry.captureMessage(error + ': ' + optionalParams); } else { Sentry.captureException(error); } } - -/** - * Extension of Sentry's ErrorBoundary class which simply logs the error to - * console as well. - */ -export class FractalErrorBoundary extends Sentry.ErrorBoundary { - componentDidCatch( - error: Error & { - cause?: Error; - }, - errorInfo: React.ErrorInfo, - ) { - logError(error, errorInfo); - if (process.env.NODE_ENV === 'development') return; - super.componentDidCatch(error, errorInfo); - } -} diff --git a/src/providers/App/useReadOnlyValues.ts b/src/providers/App/useReadOnlyValues.ts index c711e0fb9b..badd7c25b5 100644 --- a/src/providers/App/useReadOnlyValues.ts +++ b/src/providers/App/useReadOnlyValues.ts @@ -1,4 +1,5 @@ import { ERC721__factory } from '@fractal-framework/fractal-contracts'; +import * as Sentry from '@sentry/react'; import { useEffect, useState, useCallback } from 'react'; import { getAddress } from 'viem'; import useSignerOrProvider from '../../hooks/utils/useSignerOrProvider'; @@ -57,9 +58,12 @@ export const useReadOnlyValues = ({ node, governance }: Fractal, _account?: stri } }; + const address = _account ? getAddress(_account) : undefined; + Sentry.setUser(address ? { id: address } : null); + setReadOnlyValues({ user: { - address: _account ? getAddress(_account) : undefined, + address, votingWeight: await getVotingWeight(), }, dao: !node.daoAddress diff --git a/src/providers/Providers.tsx b/src/providers/Providers.tsx index 659189dfa2..ce8bfd460c 100644 --- a/src/providers/Providers.tsx +++ b/src/providers/Providers.tsx @@ -5,9 +5,9 @@ import { ReactNode } from 'react'; import { ToastContainer } from 'react-toastify'; import { WagmiProvider } from 'wagmi'; import { theme } from '../assets/theme'; -import { ErrorFallback } from '../components/ui/utils/ErrorFallback'; +import { ErrorBoundary } from '../components/ui/utils/ErrorBoundary'; +import { TopErrorFallback } from '../components/ui/utils/TopErrorFallback'; import graphQLClient from '../graphql'; -import { FractalErrorBoundary } from '../helpers/errorLogging'; import { AppProvider } from './App/AppProvider'; import EthersContextProvider from './Ethers'; import { NetworkConfigProvider } from './NetworkConfig/NetworkConfigProvider'; @@ -19,7 +19,10 @@ export default function Providers({ children }: { children: ReactNode }) { theme={theme} resetCSS > - }> + } + showDialog + > @@ -39,7 +42,7 @@ export default function Providers({ children }: { children: ReactNode }) { - + ); } diff --git a/src/router.tsx b/src/router.tsx index 45ed45b973..dd07f23944 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -1,3 +1,4 @@ +import { wrapCreateBrowserRouter } from '@sentry/react'; import { createBrowserRouter, redirect } from 'react-router-dom'; import { ModalProvider } from './components/ui/modals/ModalProvider'; import Layout from './components/ui/page/Layout'; @@ -18,7 +19,7 @@ import SettingsPage from './pages/daos/[daoAddress]/settings'; import Treasury from './pages/daos/[daoAddress]/treasury'; export const router = (addressPrefix: string) => - createBrowserRouter([ + wrapCreateBrowserRouter(createBrowserRouter)([ { path: '/', element: ( @@ -102,6 +103,7 @@ export const router = (addressPrefix: string) => // this exists to keep old links working // /daos/0x0123/* will redirect to /home?dao=0x0123 path: 'daos/:daoAddress/*', + // @ts-ignore:next-line loader: ({ params: { daoAddress } }) => redirect(`/home?dao=${addressPrefix}:${daoAddress}`), }, diff --git a/vite.config.mts b/vite.config.mts index 915438f801..4bea8baf55 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -9,4 +9,7 @@ export default defineConfig({ server: { port: 3000, }, + build: { + sourcemap: true, + }, });