Skip to content

Commit

Permalink
Fixes New Version Available + Reduces Sentry transaction amount (elec…
Browse files Browse the repository at this point in the history
…tricitymaps#173)

Co-authored-by: Tony <[email protected]>
  • Loading branch information
madsnedergaard and tonypls authored Jan 23, 2023
1 parent e5a0c87 commit 2712434
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Suspense fallback={<div />}>
Expand Down
1 change: 1 addition & 0 deletions web/src/api/getAppVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export const useGetAppVersion = () =>
useQuery<{ version: string }>([], async () => getVersion(), {
refetchInterval: REFETCH_INTERVAL_ONE_HOUR,
refetchOnWindowFocus: false,
cacheTime: 0,
});
2 changes: 1 addition & 1 deletion web/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
/**
Expand Down

0 comments on commit 2712434

Please sign in to comment.