diff --git a/apps/web/src/providers/posthog.tsx b/apps/web/src/providers/posthog.tsx index a79e96c933..30e8792fab 100644 --- a/apps/web/src/providers/posthog.tsx +++ b/apps/web/src/providers/posthog.tsx @@ -1,6 +1,6 @@ import { PostHogProvider as PostHogReactProvider } from "@posthog/react"; import posthog from "posthog-js"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef } from "react"; import { env } from "../env"; @@ -14,32 +14,27 @@ export function PostHogProvider({ enabled: boolean; }) { const didInitRef = useRef(false); - const [isInitialized, setIsInitialized] = useState(false); useEffect(() => { if ( typeof window === "undefined" || !enabled || !env.VITE_POSTHOG_API_KEY || - isDev + isDev || + didInitRef.current ) { - setIsInitialized(false); return; } - if (!didInitRef.current) { - posthog.init(env.VITE_POSTHOG_API_KEY, { - api_host: env.VITE_POSTHOG_HOST, - autocapture: true, - capture_pageview: true, - }); - didInitRef.current = true; - } - - setIsInitialized(true); + posthog.init(env.VITE_POSTHOG_API_KEY, { + api_host: env.VITE_POSTHOG_HOST, + autocapture: true, + capture_pageview: true, + }); + didInitRef.current = true; }, [enabled]); - if (!enabled || !env.VITE_POSTHOG_API_KEY || isDev || !isInitialized) { + if (!env.VITE_POSTHOG_API_KEY || isDev) { return <>{children}; } diff --git a/apps/web/src/styles.css b/apps/web/src/styles.css index 4e7bd286f5..1ccaa05720 100644 --- a/apps/web/src/styles.css +++ b/apps/web/src/styles.css @@ -3,6 +3,7 @@ src: url("/fonts/Redaction-Regular.otf") format("opentype"); font-weight: normal; font-style: normal; + font-display: swap; } @font-face { @@ -10,6 +11,7 @@ src: url("/fonts/Redaction35-Regular.otf") format("opentype"); font-weight: 350; font-style: normal; + font-display: swap; } @font-face { @@ -17,6 +19,7 @@ src: url("/fonts/Redaction70-Regular.otf") format("opentype"); font-weight: 700; font-style: normal; + font-display: swap; } @font-face { @@ -24,6 +27,7 @@ src: url("/fonts/SF-Pro-Text-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; + font-display: swap; } @font-face { @@ -31,6 +35,7 @@ src: url("/fonts/SF-Pro-Text-Medium.otf") format("opentype"); font-weight: 500; font-style: normal; + font-display: swap; } @font-face { @@ -38,6 +43,7 @@ src: url("/fonts/SF-Pro-Text-Semibold.otf") format("opentype"); font-weight: 600; font-style: normal; + font-display: swap; } @font-face { @@ -45,6 +51,7 @@ src: url("/fonts/SF-Pro-Text-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; + font-display: swap; } @import "tailwindcss";