[WEB-5413] feat: adding sentry error handling in web, space and admin (#8099)
This commit is contained in:
parent
0b78e03055
commit
30da349475
33 changed files with 872 additions and 414 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import type { ReactNode } from "react";
|
||||
import * as Sentry from "@sentry/react-router";
|
||||
import Script from "next/script";
|
||||
import { Links, Meta, Outlet, Scripts } from "react-router";
|
||||
import type { LinksFunction } from "react-router";
|
||||
|
|
@ -35,7 +36,7 @@ export const links: LinksFunction = () => [
|
|||
];
|
||||
|
||||
export function Layout({ children }: { children: ReactNode }) {
|
||||
const isSessionRecorderEnabled = parseInt(process.env.NEXT_PUBLIC_ENABLE_SESSION_RECORDER || "0");
|
||||
const isSessionRecorderEnabled = parseInt(process.env.VITE_ENABLE_SESSION_RECORDER || "0");
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
|
|
@ -67,20 +68,16 @@ export function Layout({ children }: { children: ReactNode }) {
|
|||
</div>
|
||||
</AppProvider>
|
||||
<Scripts />
|
||||
{process.env.NEXT_PUBLIC_PLAUSIBLE_DOMAIN && (
|
||||
<Script
|
||||
defer
|
||||
data-domain={process.env.NEXT_PUBLIC_PLAUSIBLE_DOMAIN}
|
||||
src="https://plausible.io/js/script.js"
|
||||
/>
|
||||
{process.env.VITE_PLAUSIBLE_DOMAIN && (
|
||||
<Script defer data-domain={process.env.VITE_PLAUSIBLE_DOMAIN} src="https://plausible.io/js/script.js" />
|
||||
)}
|
||||
{!!isSessionRecorderEnabled && process.env.NEXT_PUBLIC_SESSION_RECORDER_KEY && (
|
||||
{!!isSessionRecorderEnabled && process.env.VITE_SESSION_RECORDER_KEY && (
|
||||
<Script id="clarity-tracking">
|
||||
{`(function(c,l,a,r,i,t,y){
|
||||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
||||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
||||
y=l.getElementsByTagName(r)[0];if(y){y.parentNode.insertBefore(t,y);}
|
||||
})(window, document, "clarity", "script", "${process.env.NEXT_PUBLIC_SESSION_RECORDER_KEY}");`}
|
||||
})(window, document, "clarity", "script", "${process.env.VITE_SESSION_RECORDER_KEY}");`}
|
||||
</Script>
|
||||
)}
|
||||
</body>
|
||||
|
|
@ -127,5 +124,9 @@ export function HydrateFallback() {
|
|||
}
|
||||
|
||||
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
||||
if (error) {
|
||||
Sentry.captureException(error);
|
||||
}
|
||||
|
||||
return <CustomErrorComponent error={error} />;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue