fix: Force dynamic rendering and improve error handling

- Add 'force-dynamic' to app/page.tsx to ensure daily puzzle is generated on every request
- Improve error message in Game component when no puzzle is available
- Add logging to getDailyPuzzle for debugging
This commit is contained in:
Hördle Bot
2025-11-21 16:25:01 +01:00
parent 616b721183
commit f22aea6341
2 changed files with 10 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
import Game from '@/components/Game'; import Game from '@/components/Game';
export const dynamic = 'force-dynamic';
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
// PrismaClient is attached to the `global` object in development to prevent // PrismaClient is attached to the `global` object in development to prevent

View File

@@ -32,7 +32,14 @@ export default function Game({ dailyPuzzle }: GameProps) {
} }
}, [gameState, dailyPuzzle]); }, [gameState, dailyPuzzle]);
if (!dailyPuzzle) return <div>Loading puzzle...</div>; if (!dailyPuzzle) return (
<div className="game-container" style={{ textAlign: 'center', padding: '2rem' }}>
<h2>No Puzzle Available</h2>
<p>Could not generate a daily puzzle.</p>
<p>Please ensure there are songs in the database.</p>
<a href="/admin" style={{ color: 'var(--primary)', textDecoration: 'underline' }}>Go to Admin Dashboard</a>
</div>
);
if (!gameState) return <div>Loading state...</div>; if (!gameState) return <div>Loading state...</div>;
const handleGuess = (song: any) => { const handleGuess = (song: any) => {