mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: resolve analytics data gaps and resize validation failures
- Fix resize 20% failure rate: add Zod refine requiring at least one dimension, enforce integer/max constraints, clamp percentage scaling to minimum 1px, and guard against missing metadata in withoutEnlargement - Fix PostHog init race condition: move consent check before async import so frontend events (search, pageview) are no longer silently dropped - Fix identify() passing nested $set/$set_once wrappers instead of flat properties, so version person property now appears on PostHog profiles - Add error_code and error_message to failed tool_used analytics events for debugging tool failures from PostHog
This commit is contained in:
@@ -5,7 +5,7 @@ import { Toaster } from "sonner";
|
||||
import { ConnectionMonitor } from "./components/common/connection-monitor";
|
||||
import { KeyboardShortcutProvider } from "./components/common/keyboard-shortcut-provider";
|
||||
import { useAuth } from "./hooks/use-auth";
|
||||
import { identify, initAnalytics } from "./lib/analytics";
|
||||
import { identify, initAnalytics, setAnalyticsConsent } from "./lib/analytics";
|
||||
import { useAnalyticsStore } from "./stores/analytics-store";
|
||||
|
||||
// Lazy-load all pages so each page's JS (and its icons/deps) is only
|
||||
@@ -190,11 +190,13 @@ export function App() {
|
||||
)
|
||||
return;
|
||||
void (async () => {
|
||||
setAnalyticsConsent(true);
|
||||
await initAnalytics(analyticsConfig);
|
||||
identify(analyticsConfig.instanceId, {
|
||||
$set: { version: APP_VERSION },
|
||||
$set_once: { instance_id: analyticsConfig.instanceId },
|
||||
});
|
||||
identify(
|
||||
analyticsConfig.instanceId,
|
||||
{ version: APP_VERSION },
|
||||
{ instance_id: analyticsConfig.instanceId },
|
||||
);
|
||||
})();
|
||||
}, [analyticsConfigLoaded, analyticsConfig, analyticsConsent.analyticsEnabled]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user