Don't assume PostHog is available (#1258)

Fixes #1257
This commit is contained in:
Jamil
2022-12-31 15:40:23 -06:00
committed by GitHub
parent 1de24ff77e
commit 5b4e9e74e5

View File

@@ -6,7 +6,11 @@ export default function InstallBlock() {
return (
<BrowserOnly fallback={<div>Loading...</div>}>
{() => {
const distinct_id = window.posthog.get_distinct_id()
if (window.posthog && typeof window.posthog.get_distinct_id === "function") {
const distinct_id = window.posthog.get_distinct_id()
} else {
const distinct_id = "posthog-blocked"
}
return (
<CodeBlock language="bash">