Files
formbricks/apps/web/app/(app)/PosthogIdentify.tsx
T
Anshuman Pandey 0225362a92 feat: Add caching to more services (survey, environment, team, profile) (#835)
* feat: caching in surveys

* fix: fixes unstable_cache date parsing error

* fix: fixes survey revalidation in displays and responses

* fix: fixes survey cache

* fix: adds comments

* fix: response cache tag

* fix cache validation and tag naming

* move TSurveysWithAnalytics to TSurveys

* add caching to more services

---------

Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-09-30 14:22:42 +02:00

20 lines
539 B
TypeScript

"use client";
import { env } from "@/env.mjs";
import type { Session } from "next-auth";
import { usePostHog } from "posthog-js/react";
import { useEffect } from "react";
const posthogEnabled = env.NEXT_PUBLIC_POSTHOG_API_KEY && env.NEXT_PUBLIC_POSTHOG_API_HOST;
export default function PosthogIdentify({ session }: { session: Session }) {
const posthog = usePostHog();
useEffect(() => {
if (posthogEnabled && session.user && posthog) {
posthog.identify(session.user.id);
}
}, [session, posthog]);
return null;
}