fix: resolve schedule data staleness in production builds

- Replace window.location.reload() with router.refresh() in ScheduleGenerator, MatchEditor, RecalculateEloButton for proper Next.js cache invalidation
- Add revalidatePath() call after schedule generation in POST handler
- Add ownerId to tournament creation in cucumber tests for proper permission checks
- Assign tournament_admin role via Prisma after user creation in cucumber tests
- Fix TypeScript type annotations in hooks.ts (tournament id map)
- Update page reload to use networkidle in common-steps.ts
- Clear .next/ cache before cucumber tests in justfile
- Add .turbo to clean target
- Add comprehensive debug logging to schedule API route
- Document findings in docs/TROUBLESHOOTING_SCHEDULE_GENERATION.md
This commit is contained in:
2026-05-01 16:39:50 -07:00
parent 9353ab1edc
commit caefb0dcc0
11 changed files with 454 additions and 23 deletions
+4 -2
View File
@@ -1,6 +1,7 @@
"use client"
import { useState } from "react"
import { useRouter } from "next/navigation"
import type { Player, Match } from "@prisma/client"
interface MatchEditorProps {
@@ -40,6 +41,7 @@ export default function MatchEditor({
prefilledP4,
prefilledRound,
}: MatchEditorProps) {
const router = useRouter()
// Check if players are prefilled from URL params
const hasPrefilledPlayers = prefilledP1 && prefilledP2 && prefilledP3 && prefilledP4;
@@ -170,9 +172,9 @@ export default function MatchEditor({
isCasual: false,
})
// Reload the page to show updated matches
// Refresh the page to show updated matches
setTimeout(() => {
window.location.reload()
router.refresh()
}, 1000)
} catch {
setError("An error occurred. Please try again.")