summaryrefslogtreecommitdiff
path: root/extension/react-app/src/hooks/CustomPostHogProvider.tsx
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-10-18 23:27:15 -0700
committerTuowen Zhao <ztuowen@gmail.com>2023-10-18 23:30:20 -0700
commit08f38574fa2633bbf709d24e1c79417d4285ba61 (patch)
tree6a60ee3f013295b56d6d2c1c67f46761054023b1 /extension/react-app/src/hooks/CustomPostHogProvider.tsx
parent9168219b829aab55fefcb114937d3fc196548cde (diff)
downloadsncontinue-08f38574fa2633bbf709d24e1c79417d4285ba61.tar.gz
sncontinue-08f38574fa2633bbf709d24e1c79417d4285ba61.tar.bz2
sncontinue-08f38574fa2633bbf709d24e1c79417d4285ba61.zip
cleanup ui
Diffstat (limited to 'extension/react-app/src/hooks/CustomPostHogProvider.tsx')
-rw-r--r--extension/react-app/src/hooks/CustomPostHogProvider.tsx29
1 files changed, 2 insertions, 27 deletions
diff --git a/extension/react-app/src/hooks/CustomPostHogProvider.tsx b/extension/react-app/src/hooks/CustomPostHogProvider.tsx
index cc6de4a2..208297d4 100644
--- a/extension/react-app/src/hooks/CustomPostHogProvider.tsx
+++ b/extension/react-app/src/hooks/CustomPostHogProvider.tsx
@@ -1,32 +1,7 @@
-import posthog from "posthog-js";
-import { PostHogProvider } from "posthog-js/react";
-import { PropsWithChildren, useEffect } from "react";
-import { RootStore } from "../redux/store";
-import { useSelector } from "react-redux";
-import React from "react";
+import { PropsWithChildren } from "react";
const CustomPostHogProvider = ({ children }: PropsWithChildren) => {
- const allowAnonymousTelemetry = useSelector(
- (store: RootStore) => store?.serverState?.config?.allow_anonymous_telemetry
- );
-
- const [client, setClient] = React.useState<any>(undefined);
-
- useEffect(() => {
- if (allowAnonymousTelemetry) {
- posthog.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", {
- api_host: "https://app.posthog.com",
- disable_session_recording: true,
- });
- setClient(client);
- } else {
- setClient(undefined);
- }
- }, [allowAnonymousTelemetry]);
-
- return allowAnonymousTelemetry ? (
- <PostHogProvider client={client}>{children}</PostHogProvider>
- ) : (
+ return (
<>{children}</>
);
};