diff --git a/components/switch-account.js b/components/switch-account.js index 9615920e..409d181b 100644 --- a/components/switch-account.js +++ b/components/switch-account.js @@ -5,6 +5,7 @@ import cookie from 'cookie' import { useMe, useMeRefresh } from './me' import Image from 'react-bootstrap/Image' import Link from 'next/link' +import { SSR } from '../lib/constants' const AccountContext = createContext() @@ -35,10 +36,12 @@ export const AccountProvider = ({ children }) => { }, [setAccounts]) const isAnon = useMemo(() => { + // document not defined on server + if (SSR) return false const { 'multi_auth.user-id': multiAuthUserIdCookie } = cookie.parse(document.cookie) if (!multiAuthUserIdCookie) return false return multiAuthUserIdCookie === 'anonymous' - }, [document.cookie]) + }, [accounts]) return {children} }