mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 23:07:02 +08:00
fix: prevent sentry from loading when telemetry is disabled (#10543)
Co-authored-by: forehalo <forehalo@gmail.com>
This commit is contained in:
@@ -8,7 +8,6 @@ import { useAppUpdater } from '@affine/core/components/hooks/use-app-updater';
|
||||
import { UrlService } from '@affine/core/modules/url';
|
||||
import { appIconMap, appNames } from '@affine/core/utils/channel';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import { mixpanel } from '@affine/track';
|
||||
import { ArrowRightSmallIcon, OpenInNewIcon } from '@blocksuite/icons/rc';
|
||||
import { useServices } from '@toeverything/infra';
|
||||
import { useCallback } from 'react';
|
||||
@@ -47,11 +46,6 @@ export const AboutAffine = () => {
|
||||
|
||||
const onSwitchTelemetry = useCallback(
|
||||
(checked: boolean) => {
|
||||
if (!checked) {
|
||||
mixpanel.opt_out_tracking();
|
||||
} else {
|
||||
mixpanel.opt_in_tracking();
|
||||
}
|
||||
updateSettings('enableTelemetry', checked);
|
||||
},
|
||||
[updateSettings]
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { enableAutoTrack, mixpanel } from '@affine/track';
|
||||
import { appSettingAtom } from '@toeverything/infra';
|
||||
import { useAtomValue } from 'jotai/react';
|
||||
import { useLayoutEffect } from 'react';
|
||||
|
||||
export function Telemetry() {
|
||||
const settings = useAtomValue(appSettingAtom);
|
||||
useLayoutEffect(() => {
|
||||
if (settings.enableTelemetry === false) {
|
||||
mixpanel.opt_out_tracking();
|
||||
return;
|
||||
} else {
|
||||
return enableAutoTrack(document.body, mixpanel.track);
|
||||
}
|
||||
}, [settings.enableTelemetry]);
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user