From 2325a4438d33cad97cce774d0f68d305df459e75 Mon Sep 17 00:00:00 2001 From: Tom Xu Date: Mon, 27 Apr 2020 15:02:07 +0800 Subject: [PATCH] fix: npm run site (#23658) --- site/theme/template/Layout/Header/Navigation.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site/theme/template/Layout/Header/Navigation.tsx b/site/theme/template/Layout/Header/Navigation.tsx index fad92abeee..c79bbe40ce 100644 --- a/site/theme/template/Layout/Header/Navigation.tsx +++ b/site/theme/template/Layout/Header/Navigation.tsx @@ -32,6 +32,7 @@ export default ({ onLangChange, onDirectionChange, }: NavigationProps) => { + const [isGitee, setIsGitee] = React.useState(false); const menuMode = isMobile ? 'inline' : 'horizontal'; const module = pathname.split('/').slice(0, -1).join('/'); @@ -68,7 +69,9 @@ export default ({ ); } - const isGitee = document.location.host.indexOf('gitee') !== -1; + React.useEffect(() => { + setIsGitee(document.location.host.indexOf('gitee') !== -1); + }, []); return (