From 7a5e32bdf66af180dbcee6ff9467a27fc33ac533 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 8 Jul 2021 16:25:12 -0400 Subject: [PATCH] Don't show sentry preference if init fails Signed-off-by: Sebastian Malton --- src/common/sentry.ts | 5 +++++ src/renderer/components/+preferences/preferences.tsx | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/sentry.ts b/src/common/sentry.ts index e8462ffc2f..36435b86c9 100644 --- a/src/common/sentry.ts +++ b/src/common/sentry.ts @@ -24,6 +24,8 @@ import { sentryDsn, isProduction } from "./vars"; import { UserStore } from "./user-store"; import logger from "../main/logger"; +export let sentryIsInitialized = false; + /** * This function bypasses webpack issues. * @@ -77,6 +79,9 @@ export async function SentryInit(): Promise { }, environment: isProduction ? "production" : "development", }); + + sentryIsInitialized = true; + logger.info(`✔️ [SENTRY-INIT]: Sentry for ${process.type} is initialized.`); } catch (error) { logger.warn(`⚠️ [SENTRY-INIT]: Sentry.init() error: ${error?.message ?? error}.`); diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index 6e9ae5f210..285c9b2c75 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -41,7 +41,7 @@ import { FormSwitch, Switcher } from "../switch"; import { KubeconfigSyncs } from "./kubeconfig-syncs"; import { SettingLayout } from "../layout/setting-layout"; import { Checkbox } from "../checkbox"; -import { sentryDsn } from "../../../common/vars"; +import { sentryIsInitialized } from "../../../common/sentry"; enum Pages { Application = "application", @@ -259,7 +259,7 @@ export class Preferences extends React.Component {

Telemetry

{telemetryExtensions.map(this.renderExtension)} - {sentryDsn ? ( + {sentryIsInitialized ? (