mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-24 02:47:53 -05:00
0225362a92
* 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>
20 lines
539 B
TypeScript
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;
|
|
}
|