trackEvent in ErrorBoundary, disable trackEvent in dev
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
376096c5af
commit
7073e8d9dd
@ -1,5 +1,7 @@
|
||||
import React from "react";
|
||||
|
||||
import {trackEvent} from "@/Utils";
|
||||
|
||||
interface ErrorBoundaryState {
|
||||
hasError: boolean;
|
||||
errorMessage?: string;
|
||||
@ -21,6 +23,7 @@ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps, E
|
||||
|
||||
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
||||
console.error("Caught an error:", error, errorInfo);
|
||||
trackEvent("error", { error: error.message, errorInfo: JSON.stringify(errorInfo) });
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -56,24 +56,26 @@ export default function Index() {
|
||||
const isStalker = !!stalker;
|
||||
|
||||
return (
|
||||
<div className="flex justify-center">
|
||||
<div className="w-full max-w-screen-xl">
|
||||
<div className="flex flex-row">
|
||||
<NavSidebar />
|
||||
<div className="flex flex-1 flex-col pb-footer-height md:pb-0 w-full md:w-1/3">
|
||||
{!shouldHideHeader && <Header />}
|
||||
<ErrorBoundary>
|
||||
<Outlet />
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary>
|
||||
<div className="flex justify-center">
|
||||
<div className="w-full max-w-screen-xl">
|
||||
<div className="flex flex-row">
|
||||
<NavSidebar />
|
||||
<div className="flex flex-1 flex-col pb-footer-height md:pb-0 w-full md:w-1/3">
|
||||
{!shouldHideHeader && <Header />}
|
||||
<ErrorBoundary>
|
||||
<Outlet />
|
||||
</ErrorBoundary>
|
||||
</div>
|
||||
<RightColumn />
|
||||
</div>
|
||||
<RightColumn />
|
||||
<Toaster />
|
||||
</div>
|
||||
<Toaster />
|
||||
<LoginUnlock />
|
||||
{isStalker && <StalkerModal id={id} />}
|
||||
{!shouldHideFooter && <Footer />}
|
||||
</div>
|
||||
<LoginUnlock />
|
||||
{isStalker && <StalkerModal id={id} />}
|
||||
{!shouldHideFooter && <Footer />}
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ export function trackEvent(
|
||||
props?: Record<string, string | boolean>,
|
||||
e?: { destination?: { url: string } },
|
||||
) {
|
||||
if (CONFIG.features.analytics && (LoginStore.snapshot().appData.item.preferences.telemetry ?? true)) {
|
||||
if (!import.meta.env.DEV && CONFIG.features.analytics && (LoginStore.snapshot().appData.item.preferences.telemetry ?? true)) {
|
||||
fetch("https://analytics.v0l.io/api/event", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
Loading…
Reference in New Issue
Block a user