From 0cab63fc6def6fad6bbdb5a71c14a412832f7b3c Mon Sep 17 00:00:00 2001 From: Ethan Zhang Date: Wed, 14 Aug 2024 23:00:33 +0800 Subject: [PATCH] Bugfix/build (#208) * fix: build error * fix: fix build failure * fix: fix compile error * fix: fix navigator not defined issue --------- Co-authored-by: Jay Zhang --- playground/src/app/home/page.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/playground/src/app/home/page.tsx b/playground/src/app/home/page.tsx index aa5adfec..a94b9ba9 100644 --- a/playground/src/app/home/page.tsx +++ b/playground/src/app/home/page.tsx @@ -3,6 +3,7 @@ import AuthInitializer from "@/components/authInitializer" import { isMobile } from "@/common" import dynamic from 'next/dynamic' +import { useEffect, useState } from "react" const PCEntry = dynamic(() => import('@/platform/pc/entry'), { ssr: false, @@ -13,10 +14,16 @@ const MobileEntry = dynamic(() => import('@/platform/mobile/entry'), { }) export default function Home() { + const [mobile, setMobile] = useState(null); + + useEffect(() => { + setMobile(isMobile()) + }) return ( + mobile === null ? <> : - {isMobile() ? : } + {mobile ? : } ); }