Skip to content

Commit bf2c943

Browse files
committed
fix(link):start round
1 parent 59270d4 commit bf2c943

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

client/src/lib/actions/checkauth.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,7 @@ import { redirect } from "next/navigation";
44
import { auth } from "../../../server/auth";
55

66
// List of authorized admin emails
7-
const authorizedEmails = [
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22-
];
7+
const authorizedEmails = ["[email protected]"];
238

249
const routeProtect = async () => {
2510
const session = await auth();

client/src/lib/actions/rounds.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
import db from "@/db/index";
44
import { gameState } from "@/db/schema";
55
import { redirect } from "next/navigation";
6-
import { unstable_cache, revalidateTag } from "next/cache";
76
import { eq } from "drizzle-orm";
87

9-
// Internal helper to fetch (and lazily create) the GameState row.
10-
async function fetchCurrentRoundFromDB(): Promise<number> {
8+
// Get current round directly from database
9+
export async function getCurrentRound(): Promise<number> {
1110
const gameStateResult = await db.select().from(gameState).limit(1);
1211
if (!gameStateResult.length) {
1312
const result = await db
@@ -22,17 +21,7 @@ async function fetchCurrentRoundFromDB(): Promise<number> {
2221
return gameStateResult[0].currentRound;
2322
}
2423

25-
// Cached getter using unstable_cache with an explicit tag so we can invalidate on round advance.
26-
// The cache key array value "game-state-current-round" is arbitrary but must stay stable.
27-
export const getCurrentRound = unstable_cache(
28-
async () => {
29-
return await fetchCurrentRoundFromDB();
30-
},
31-
["game-state-current-round"],
32-
{ tags: ["currentRound"] }
33-
);
34-
35-
// Advance to the next round and invalidate the cached value.
24+
// Advance to the next round.
3625
// Optionally accept an explicit nextRound (e.g. for admin controls) otherwise increments by 1.
3726
export async function advanceRound(nextRound?: number) {
3827
// Ensure a row exists and get its id & current value.
@@ -65,9 +54,6 @@ export async function advanceRound(nextRound?: number) {
6554
})
6655
.where(eq(gameState.id, gameStateRecord.id));
6756

68-
// Invalidate the cached round so subsequent calls see the fresh value.
69-
revalidateTag("currentRound");
70-
7157
return newRound;
7258
}
7359

0 commit comments

Comments
 (0)