Skip to content

Commit

Permalink
chore(core): handle the telemetry warnings in console (#6793)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed May 7, 2024
1 parent 6cd0c7c commit d76a635
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export class TelemetryService extends Service {
}

onApplicationStart() {
if (process.env.MIXPANEL_TOKEN) {
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
track_pageview: true,
persistence: 'localStorage',
});
}
const account = this.auth.session.account$.value;
if (account) {
mixpanel.identify(account.id);
Expand Down
10 changes: 2 additions & 8 deletions packages/frontend/core/src/telemetry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@ import { useLayoutEffect } from 'react';
export function Telemetry() {
const settings = useAtomValue(appSettingAtom);
useLayoutEffect(() => {
if (process.env.MIXPANEL_TOKEN) {
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
track_pageview: true,
persistence: 'localStorage',
});
if (settings.enableTelemetry === false) {
mixpanel.opt_out_tracking();
}
if (settings.enableTelemetry === false) {
mixpanel.opt_out_tracking();
}
}, [settings.enableTelemetry]);
return null;
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/electron/renderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '@affine/core/bootstrap/preload';
import { appConfigProxy } from '@affine/core/hooks/use-app-config-storage';
import { performanceLogger } from '@affine/core/shared';
import { apis, events } from '@affine/electron-api';
import { init, replayIntegration, setTags } from '@sentry/electron/renderer';
import { init, setTags } from '@sentry/electron/renderer';
import {
init as reactInit,
reactRouterV6BrowserTracingIntegration,
Expand Down Expand Up @@ -50,7 +50,6 @@ function main() {
createRoutesFromChildren,
matchRoutes,
}),
replayIntegration(),
],
},
reactInit
Expand Down
2 changes: 0 additions & 2 deletions packages/frontend/web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { isDesktop } from '@affine/env/constant';
import {
init,
reactRouterV6BrowserTracingIntegration,
replayIntegration,
setTags,
} from '@sentry/react';
import { StrictMode, useEffect } from 'react';
Expand Down Expand Up @@ -44,7 +43,6 @@ function main() {
createRoutesFromChildren,
matchRoutes,
}),
replayIntegration(),
],
});
setTags({
Expand Down

0 comments on commit d76a635

Please sign in to comment.