From 4a2438201d0e365a873632a1ffcf913661eacbec Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 20 Mar 2025 20:36:46 +0900 Subject: fix(frontend): fix hydration error --- frontend/app/states/play.ts | 9 ++++----- frontend/app/states/watch.ts | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/frontend/app/states/play.ts b/frontend/app/states/play.ts index 3acefbf..7bf4b4e 100644 --- a/frontend/app/states/play.ts +++ b/frontend/app/states/play.ts @@ -16,15 +16,14 @@ type ExecutionStatus = components["schemas"]["ExecutionStatus"]; type LatestGameState = components["schemas"]["LatestGameState"]; export const gameStateKindAtom = atom((get) => { - const startedAt = get(gameStartedAtAtom); - if (!startedAt) { - return "waiting"; - } - const now = get(currentTimestampAtom); if (!now) { return "loading"; } + const startedAt = get(gameStartedAtAtom); + if (!startedAt) { + return "waiting"; + } const durationSeconds = get(durationSecondsAtom); const finishedAt = startedAt + durationSeconds; if (now < startedAt) { diff --git a/frontend/app/states/watch.ts b/frontend/app/states/watch.ts index 463c2cd..14a70b4 100644 --- a/frontend/app/states/watch.ts +++ b/frontend/app/states/watch.ts @@ -16,15 +16,14 @@ type LatestGameState = components["schemas"]["LatestGameState"]; type RankingEntry = components["schemas"]["RankingEntry"]; export const gameStateKindAtom = atom((get) => { - const startedAt = get(gameStartedAtAtom); - if (!startedAt) { - return "waiting"; - } - const now = get(currentTimestampAtom); if (!now) { return "loading"; } + const startedAt = get(gameStartedAtAtom); + if (!startedAt) { + return "waiting"; + } const durationSeconds = get(durationSecondsAtom); const finishedAt = startedAt + durationSeconds; if (now < startedAt) { -- cgit v1.2.3-70-g09d2