fix: Address QA issues - force dynamic rendering and document middleware trade-off (qa-requested)

Fixes:
- Add dynamic export to dashboard page to prevent Next.js pre-rendering
- Fixes critical auth bypass where cached page was served to all users
- Document middleware response propagation trade-off

QA Issues Fixed:
- Issue #1: Dashboard page pre-rendering bypasses authentication
- Issue #3: Middleware response object not propagated (documented)

Verified:
- TypeScript compilation passes
- Code follows Next.js 15 auth best practices
- Middleware trade-off documented per QA recommendation

QA Fix Session: 1

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-25 12:20:49 +01:00
co-authored by Claude Sonnet 4.5
parent 23c79f1fa2
commit 5551226353
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -4,6 +4,9 @@ import { redirect } from 'next/navigation';
import DashboardContent from '@/components/auth/DashboardContent'; import DashboardContent from '@/components/auth/DashboardContent';
import { createClient } from '@/lib/supabase/server'; import { createClient } from '@/lib/supabase/server';
// Force dynamic rendering to ensure auth checks run on every request
export const dynamic = 'force-dynamic';
type Props = { type Props = {
params: Promise<{ locale: string }>; params: Promise<{ locale: string }>;
}; };
+3
View File
@@ -37,6 +37,9 @@ export async function middleware(request: NextRequest) {
} }
// Continue with i18n middleware for all routes // Continue with i18n middleware for all routes
// Note: For authenticated dashboard users, we prioritize i18n over potential
// Supabase cookie updates. getUser() is read-only and token refresh typically
// occurs during sign-in/sign-out, not during middleware checks.
return intlMiddleware(request); return intlMiddleware(request);
} }