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:
@@ -1,5 +1,7 @@
|
||||
import Game from '@/components/Game';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
// PrismaClient is attached to the `global` object in development to prevent
|
||||
|
||||
@@ -32,7 +32,14 @@ export default function Game({ dailyPuzzle }: GameProps) {
|
||||
}
|
||||
}, [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>;
|
||||
|
||||
const handleGuess = (song: any) => {
|
||||
|
||||
Reference in New Issue
Block a user