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 React from "react";
|
||||||
|
|
||||||
|
import {trackEvent} from "@/Utils";
|
||||||
|
|
||||||
interface ErrorBoundaryState {
|
interface ErrorBoundaryState {
|
||||||
hasError: boolean;
|
hasError: boolean;
|
||||||
errorMessage?: string;
|
errorMessage?: string;
|
||||||
@ -21,6 +23,7 @@ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps, E
|
|||||||
|
|
||||||
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
||||||
console.error("Caught an error:", error, errorInfo);
|
console.error("Caught an error:", error, errorInfo);
|
||||||
|
trackEvent("error", { error: error.message, errorInfo: JSON.stringify(errorInfo) });
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -56,24 +56,26 @@ export default function Index() {
|
|||||||
const isStalker = !!stalker;
|
const isStalker = !!stalker;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-center">
|
<ErrorBoundary>
|
||||||
<div className="w-full max-w-screen-xl">
|
<div className="flex justify-center">
|
||||||
<div className="flex flex-row">
|
<div className="w-full max-w-screen-xl">
|
||||||
<NavSidebar />
|
<div className="flex flex-row">
|
||||||
<div className="flex flex-1 flex-col pb-footer-height md:pb-0 w-full md:w-1/3">
|
<NavSidebar />
|
||||||
{!shouldHideHeader && <Header />}
|
<div className="flex flex-1 flex-col pb-footer-height md:pb-0 w-full md:w-1/3">
|
||||||
<ErrorBoundary>
|
{!shouldHideHeader && <Header />}
|
||||||
<Outlet />
|
<ErrorBoundary>
|
||||||
</ErrorBoundary>
|
<Outlet />
|
||||||
|
</ErrorBoundary>
|
||||||
|
</div>
|
||||||
|
<RightColumn />
|
||||||
</div>
|
</div>
|
||||||
<RightColumn />
|
<Toaster />
|
||||||
</div>
|
</div>
|
||||||
<Toaster />
|
<LoginUnlock />
|
||||||
|
{isStalker && <StalkerModal id={id} />}
|
||||||
|
{!shouldHideFooter && <Footer />}
|
||||||
</div>
|
</div>
|
||||||
<LoginUnlock />
|
</ErrorBoundary>
|
||||||
{isStalker && <StalkerModal id={id} />}
|
|
||||||
{!shouldHideFooter && <Footer />}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ export function trackEvent(
|
|||||||
props?: Record<string, string | boolean>,
|
props?: Record<string, string | boolean>,
|
||||||
e?: { destination?: { url: string } },
|
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", {
|
fetch("https://analytics.v0l.io/api/event", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Loading…
Reference in New Issue
Block a user