⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix(web,sentry): narrow Safari 'Load failed' suppression to auth-session path
justin636ad3914e3e
diff --git a/apps/web/src/components/providers/auth-provider/index.tsx b/apps/web/src/components/providers/auth-provider/index.tsxindex b03f75fa7..4f0413024 100644--- a/apps/web/src/components/providers/auth-provider/index.tsx+++ b/apps/web/src/components/providers/auth-provider/index.tsx@@ -1,4 +1,10 @@-import { createContext, type PropsWithChildren, useRef } from "react";+import * as Sentry from "@sentry/react";+import {+ createContext,+ type PropsWithChildren,+ useEffect,+ useRef,+} from "react";import { authClient } from "@/lib/auth-client";import type { User } from "@/types/user";import { LoadingSkeleton } from "../../ui/loading-skeleton";@@ -16,7 +22,7 @@ export const AuthContext = createContext<{});function AuthProvider({ children }: PropsWithChildren) {- const { data, isPending, refetch } = useSession();+ const { data, isPending, refetch, error } = useSession();// Only show the loading skeleton during the *first* session fetch. Better// Auth re-fetches the session on window focus; if we kept returning the// skeleton while those background fetches are pending we'd unmount the@@ -27,6 +33,17 @@ function AuthProvider({ children }: PropsWithChildren) {hasLoadedOnce.current = true;}+ // Tag transient Safari "Load failed" errors during the session fetch so+ // instrument.ts's beforeSend can drop them. Better Auth's useSession+ // uses nanostores rather than TanStack Query, so the query client's+ // network-error cooldown doesn't reach this path. Real auth failures+ // (e.g. 401) still surface to Sentry through Better Auth.+ useEffect(() => {+ if (error instanceof Error && error.message.includes("Load failed")) {+ Sentry.captureException(error, { tags: { area: "auth.session" } });+ }+ }, [error]);+if (isPending && !hasLoadedOnce.current) {return <LoadingSkeleton />;}diff --git a/apps/web/src/instrument.ts b/apps/web/src/instrument.tsindex f4d93bbc5..728d04ba9 100644--- a/apps/web/src/instrument.ts+++ b/apps/web/src/instrument.ts@@ -16,11 +16,15 @@ if (dsn && !dsn.startsWith("KANEO_")) {// Thrown by Facebook's in-app browser (Android) navigation performance logger// calling postMessage on a destroyed WebView Java bridge; not caused by kaneo code."Error invoking postMessage: Java object is gone",- // Safari's equivalent of Chrome's "Failed to fetch" — thrown when a fetch()- // request fails due to a transient network error (e.g. dropped mobile connection).- // Occurs on iOS/Safari during authClient.getSession() and is not a bug in kaneo code.- "Load failed",],+ // Safari's "Load failed" used to be filtered here by message alone, which+ // also silenced actionable TanStack Query fetch failures. The query client+ // already rate-limits network errors via its own cooldown; auth-provider+ // tags its transient session-fetch errors so we can drop only those here.+ beforeSend(event) {+ if (event.tags?.area === "auth.session") return null;+ return event;+ },integrations: [Sentry.browserTracingIntegration(),Sentry.replayIntegration(),