Skip to content

Commit 0cab63f

Browse files
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 <[email protected]>
1 parent c0faba2 commit 0cab63f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

playground/src/app/home/page.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import AuthInitializer from "@/components/authInitializer"
44
import { isMobile } from "@/common"
55
import dynamic from 'next/dynamic'
6+
import { useEffect, useState } from "react"
67

78
const PCEntry = dynamic(() => import('@/platform/pc/entry'), {
89
ssr: false,
@@ -13,10 +14,16 @@ const MobileEntry = dynamic(() => import('@/platform/mobile/entry'), {
1314
})
1415

1516
export default function Home() {
17+
const [mobile, setMobile] = useState<boolean | null>(null);
18+
19+
useEffect(() => {
20+
setMobile(isMobile())
21+
})
1622

1723
return (
24+
mobile === null ? <></> :
1825
<AuthInitializer>
19-
{isMobile() ? <MobileEntry></MobileEntry> : <PCEntry></PCEntry>}
26+
{mobile ? <MobileEntry></MobileEntry> : <PCEntry></PCEntry>}
2027
</AuthInitializer >
2128
);
2229
}

0 commit comments

Comments
 (0)