fix(telemetry): enable client tracking in dev
This commit is contained in:
@@ -2,7 +2,8 @@ import type { AnyRouter } from "@tanstack/react-router";
|
|||||||
|
|
||||||
// Provider-free by design: renders nothing and mounts no React context, so it
|
// Provider-free by design: renders nothing and mounts no React context, so it
|
||||||
// cannot disturb the LinguiProvider -> AuthProvider order. Browser-only; every
|
// cannot disturb the LinguiProvider -> AuthProvider order. Browser-only; every
|
||||||
// entry point is a no-op during SSR and in dev unless VITE_TELEMETRY_DEV=1.
|
// entry point is a no-op during SSR. Runs in dev too - events go to the same
|
||||||
|
// PB the app is pointed at, which in dev is the local instance.
|
||||||
|
|
||||||
type QueuedEvent = Record<string, unknown> & { kind: "event" | "error" | "vital" };
|
type QueuedEvent = Record<string, unknown> & { kind: "event" | "error" | "vital" };
|
||||||
|
|
||||||
@@ -19,9 +20,7 @@ let lastRouteId: string | undefined;
|
|||||||
let errorCount = 0;
|
let errorCount = 0;
|
||||||
const recentErrors = new Map<string, number>();
|
const recentErrors = new Map<string, number>();
|
||||||
|
|
||||||
const isEnabled = (): boolean =>
|
const isEnabled = (): boolean => typeof window !== "undefined";
|
||||||
typeof window !== "undefined" &&
|
|
||||||
(import.meta.env.PROD || import.meta.env.VITE_TELEMETRY_DEV === "1");
|
|
||||||
|
|
||||||
const getSessionId = (): string => {
|
const getSessionId = (): string => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user