From a997bec14720fab8dcdcca47bfacc90293b03809 Mon Sep 17 00:00:00 2001 From: Enno Gelhaus Date: Thu, 31 Jul 2025 22:10:40 +0200 Subject: [PATCH] Update libraries/react-shared-libraries/src/sentry/sentry.user.context.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../src/sentry/sentry.user.context.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libraries/react-shared-libraries/src/sentry/sentry.user.context.ts b/libraries/react-shared-libraries/src/sentry/sentry.user.context.ts index 4c088364..758138c3 100644 --- a/libraries/react-shared-libraries/src/sentry/sentry.user.context.ts +++ b/libraries/react-shared-libraries/src/sentry/sentry.user.context.ts @@ -60,14 +60,8 @@ export const setSentryUserContext = (user: UserInfo | null) => { * Only executes if Sentry DSN is configured. */ export const clearSentryUserContext = () => { - // Only clear context if Sentry is configured (check at runtime for frontend) - if (typeof window !== 'undefined' && !window.location.origin.includes('localhost')) { - // For production, check if Sentry DSN exists in environment or is initialized - if (!process.env.NEXT_PUBLIC_SENTRY_DSN) { - return; - } - } else if (typeof process !== 'undefined' && !process.env.NEXT_PUBLIC_SENTRY_DSN) { - // For server-side or development + // Only clear context if Sentry is configured + if (!process.env.NEXT_PUBLIC_SENTRY_DSN) { return; }