diff --git a/src/theme/DocRoot/Layout/index.js b/src/theme/DocRoot/Layout/index.js index f001bd6e8..0b01b058b 100644 --- a/src/theme/DocRoot/Layout/index.js +++ b/src/theme/DocRoot/Layout/index.js @@ -6,7 +6,7 @@ import DocRootLayoutMain from '@theme/DocRoot/Layout/Main'; import styles from './styles.module.css'; import BrowserOnly from '@docusaurus/BrowserOnly'; import { AiChatBot } from '@site/src/components/AiChatBot/AiChatBot'; -import UserFetcher from './posthogConfig'; +import UserFetcherWrapper from './posthogConfig'; export default function DocRootLayout({ children }) { const sidebar = useDocsSidebar(); @@ -15,7 +15,7 @@ export default function DocRootLayout({ children }) { return (
- +
{sidebar && ( diff --git a/src/theme/DocRoot/Layout/posthogConfig.js b/src/theme/DocRoot/Layout/posthogConfig.js index a1ce2da13..a0f4ea5b8 100644 --- a/src/theme/DocRoot/Layout/posthogConfig.js +++ b/src/theme/DocRoot/Layout/posthogConfig.js @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; import posthog from 'posthog-js'; +import BrowserOnly from '@docusaurus/BrowserOnly'; // 🦔 config posthog.init('phc_MZpdcQLGf57lyfOUT0XA93R3jaCxGsqftVt4iI4MyUY', { @@ -47,7 +48,7 @@ async function fetchUser() { } } -export default function UserFetcher() { +function UserFetcher() { const [docsUser, setDocsUser] = useState(null); useEffect(() => { @@ -64,3 +65,7 @@ export default function UserFetcher() { return null; } + +export default function UserFetcherWrapper() { + return Loading...
}>{() => }; +}