From 2712434b7e7014e79ee2462e759b3be8a36db409 Mon Sep 17 00:00:00 2001 From: Mads Nedergaard Date: Mon, 23 Jan 2023 14:34:54 +0100 Subject: [PATCH] Fixes New Version Available + Reduces Sentry transaction amount (#173) Co-authored-by: Tony --- web/src/App.tsx | 7 +++---- web/src/api/getAppVersion.ts | 1 + web/src/main.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index 5569ddfcaa..1eb3ad3c8b 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -22,10 +22,9 @@ const handleReload = () => { export default function App(): ReactElement { const currentAppVersion = APP_VERSION; const { data, isSuccess } = useGetAppVersion(); - const isNewVersionAvailable = - data?.version && currentAppVersion && isProduction - ? data.version !== currentAppVersion - : false; + const latestAppVersion = data?.version || '0'; + const isNewVersionAvailable = isProduction && latestAppVersion > currentAppVersion; + console.log('New app version available:', latestAppVersion); return ( }> diff --git a/web/src/api/getAppVersion.ts b/web/src/api/getAppVersion.ts index 5871b4f2b1..b875cf1b49 100644 --- a/web/src/api/getAppVersion.ts +++ b/web/src/api/getAppVersion.ts @@ -15,4 +15,5 @@ export const useGetAppVersion = () => useQuery<{ version: string }>([], async () => getVersion(), { refetchInterval: REFETCH_INTERVAL_ONE_HOUR, refetchOnWindowFocus: false, + cacheTime: 0, }); diff --git a/web/src/main.tsx b/web/src/main.tsx index 9d27070ebd..c7a96cec71 100644 --- a/web/src/main.tsx +++ b/web/src/main.tsx @@ -39,7 +39,7 @@ if (isProduction) { ), }), ], - tracesSampleRate: 1, //This will send 100% of errors to Sentry + tracesSampleRate: 0.1, //This will send 10% of transactions to Sentry }); } /**