From 44aa9816af87df6b5284fab520a6a5e5409bc3b0 Mon Sep 17 00:00:00 2001 From: Arda Erzin Date: Wed, 11 Dec 2024 15:59:45 +0100 Subject: [PATCH] chore(frontend): fix conflict and bring useIsomorphicLayoutEffect improvements here --- agenta-web/src/lib/helpers/analytics/hooks/usePostHogAg.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agenta-web/src/lib/helpers/analytics/hooks/usePostHogAg.ts b/agenta-web/src/lib/helpers/analytics/hooks/usePostHogAg.ts index a7ef761edb..ab3bb2a08f 100644 --- a/agenta-web/src/lib/helpers/analytics/hooks/usePostHogAg.ts +++ b/agenta-web/src/lib/helpers/analytics/hooks/usePostHogAg.ts @@ -1,9 +1,9 @@ -import {useLayoutEffect} from "react" import {isDemo, generateOrRetrieveDistinctId} from "@/lib/helpers/utils" import {useProfileData} from "@/contexts/profile.context" import {useAtom} from "jotai" import {posthogAtom} from "../store/atoms" import {type PostHog} from "posthog-js" +import useIsomorphicLayoutEffect from "@/hooks/useIsomorphicLayoutEffect" interface ExtendedPostHog extends PostHog { identify: PostHog["identify"] @@ -27,7 +27,7 @@ export const usePostHogAg = (): ExtendedPostHog | null => { posthog?.identify?.(_id !== undefined ? _id : id, ...args) } } - useLayoutEffect(() => { + useIsomorphicLayoutEffect(() => { if (!posthog) return if (!trackingEnabled) { @@ -36,7 +36,7 @@ export const usePostHogAg = (): ExtendedPostHog | null => { } }, [posthog, trackingEnabled]) - useLayoutEffect(() => { + useIsomorphicLayoutEffect(() => { if (!posthog) return if (posthog.get_distinct_id() !== _id) identify() }, [posthog, _id])