Skip to content

Commit bf6b1b6

Browse files
Chore: Improve PostHog integration based on env's present (e2b-dev#90)
This pr improves upon detecting the env vars this project is running with & conditionally render / allow certain operations on the posthog client, only if the env var is present.
1 parent 1ee14c9 commit bf6b1b6

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/features/dashboard/page-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default async function DashboardPageLayout({
4040
<Suspense fallback={null}>
4141
<ThemeSwitcher />
4242
</Suspense>
43-
<DashboardSurveyPopover />
43+
{process.env.NEXT_PUBLIC_POSTHOG_KEY && <DashboardSurveyPopover />}
4444
</div>
4545
</div>
4646

src/features/general-analytics-collector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function GeneralAnalyticsCollector() {
88
const posthog = usePostHog()
99

1010
useEffect(() => {
11-
if (!posthog) return
11+
if (!posthog || !process.env.NEXT_PUBLIC_POSTHOG_KEY) return
1212

1313
supabase.auth.onAuthStateChange((event, session) => {
1414
if (session?.user) {

0 commit comments

Comments
 (0)