Skip to content

Commit

Permalink
Bugfix/build (#208)
Browse files Browse the repository at this point in the history
* fix: build error

* fix: fix build failure

* fix: fix compile error

* fix: fix navigator not defined issue

---------

Co-authored-by: Jay Zhang <[email protected]>
  • Loading branch information
plutoless and wangyoucao577 authored Aug 14, 2024
1 parent c0faba2 commit 0cab63f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion playground/src/app/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -13,10 +14,16 @@ const MobileEntry = dynamic(() => import('@/platform/mobile/entry'), {
})

export default function Home() {
const [mobile, setMobile] = useState<boolean | null>(null);

useEffect(() => {
setMobile(isMobile())
})

return (
mobile === null ? <></> :
<AuthInitializer>
{isMobile() ? <MobileEntry></MobileEntry> : <PCEntry></PCEntry>}
{mobile ? <MobileEntry></MobileEntry> : <PCEntry></PCEntry>}
</AuthInitializer >
);
}
Expand Down

0 comments on commit 0cab63f

Please sign in to comment.