diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-29 22:15:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-29 22:15:03 +0900 |
| commit | 3a1e09991708bff1d0c0cfd5b1b091924cca9e8f (patch) | |
| tree | 7705ca2657887653814e790627ec730ac794354f /frontend/app/routes/golf.$gameId.watch.tsx | |
| parent | e0fbddb281dfe8ccbcb33c3d5f385b6ad402a476 (diff) | |
| download | phperkaigi-2025-albatross-3a1e09991708bff1d0c0cfd5b1b091924cca9e8f.tar.gz phperkaigi-2025-albatross-3a1e09991708bff1d0c0cfd5b1b091924cca9e8f.tar.zst phperkaigi-2025-albatross-3a1e09991708bff1d0c0cfd5b1b091924cca9e8f.zip | |
fix(frontend): make GolfPlayApp and GolfWatchApp client-only components to fix SSR errors
Diffstat (limited to 'frontend/app/routes/golf.$gameId.watch.tsx')
| -rw-r--r-- | frontend/app/routes/golf.$gameId.watch.tsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/frontend/app/routes/golf.$gameId.watch.tsx b/frontend/app/routes/golf.$gameId.watch.tsx index 4093295..eeb6fb9 100644 --- a/frontend/app/routes/golf.$gameId.watch.tsx +++ b/frontend/app/routes/golf.$gameId.watch.tsx @@ -1,8 +1,10 @@ import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; +import { useLoaderData } from "@remix-run/react"; +import { ClientOnly } from "remix-utils/client-only"; import { isAuthenticated } from "../.server/auth"; import { apiClient } from "../.server/api/client"; -import { useLoaderData } from "@remix-run/react"; -import GolfWatchApp from "../components/GolfWatchApp"; +import GolfWatchApp from "../components/GolfWatchApp.client"; +import GolfWatchAppConnecting from "../components/GolfWatchApps/GolfWatchAppConnecting"; export const meta: MetaFunction<typeof loader> = ({ data }) => { return [ @@ -60,5 +62,9 @@ export async function loader({ params, request }: LoaderFunctionArgs) { export default function GolfWatch() { const { game, sockToken } = useLoaderData<typeof loader>(); - return <GolfWatchApp game={game} sockToken={sockToken} />; + return ( + <ClientOnly fallback={<GolfWatchAppConnecting />}> + {() => <GolfWatchApp game={game} sockToken={sockToken} />} + </ClientOnly> + ); } |
