Force dynamic rendering on layouts/pages reading DB (fix redirect loop from cached static prerender)

This commit is contained in:
Hendrik 2026-05-01 18:19:59 +02:00
parent 19bbce4787
commit 355db7d348
3 changed files with 6 additions and 0 deletions

View file

@ -5,6 +5,8 @@ import { isSetupComplete } from "@/lib/db";
import { Sidebar } from "@/components/Sidebar";
import { UpdateBanner } from "@/components/UpdateBanner";
export const dynamic = "force-dynamic";
export default async function AppLayout({ children }: { children: React.ReactNode }) {
if (!isSetupComplete()) redirect("/setup");
const session = await getServerSession(authOptions);

View file

@ -1,6 +1,8 @@
import { redirect } from "next/navigation";
import { isSetupComplete } from "@/lib/db";
export const dynamic = "force-dynamic";
export default function AuthLayout({ children }: { children: React.ReactNode }) {
if (!isSetupComplete()) redirect("/setup");
return <>{children}</>;

View file

@ -3,6 +3,8 @@ import { getServerSession } from "next-auth";
import { authOptions } from "@/lib/auth";
import { isSetupComplete } from "@/lib/db";
export const dynamic = "force-dynamic";
export default async function RootPage() {
if (!isSetupComplete()) redirect("/setup");
const session = await getServerSession(authOptions);