diff --git a/src/components/TopbarDesktop/TopbarDesktop.js b/src/components/TopbarDesktop/TopbarDesktop.js index 54f38347..a90b91e5 100644 --- a/src/components/TopbarDesktop/TopbarDesktop.js +++ b/src/components/TopbarDesktop/TopbarDesktop.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, intlShape } from 'react-intl'; import classNames from 'classnames'; @@ -32,6 +32,14 @@ const TopbarDesktop = props => { onSearchSubmit, initialSearchFormValues, } = props; + const [mounted, setMounted] = useState(false); + + useEffect(() => { + setMounted(true); + }, []); + + const authenticatedOnClientSide = mounted && isAuthenticated; + const isAuthenticatedOrJustHydrated = isAuthenticated || !mounted; const classes = classNames(rootClassName || css.root, className); @@ -47,7 +55,7 @@ const TopbarDesktop = props => { const notificationDot = notificationCount > 0 ?
: null; - const inboxLink = isAuthenticated ? ( + const inboxLink = authenticatedOnClientSide ? (