aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/states/play.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/states/play.ts')
-rw-r--r--frontend/app/states/play.ts9
1 files changed, 4 insertions, 5 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<GameStateKind>((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) {