diff --git a/app/park/[id]/page.tsx b/app/park/[id]/page.tsx index 84d11a6..92d768a 100644 --- a/app/park/[id]/page.tsx +++ b/app/park/[id]/page.tsx @@ -73,7 +73,7 @@ export default async function ParkPage({ params, searchParams }: PageProps) { ), apiFetch( `/api/parks/${id}/rides`, - { revalidate: 60 }, + { noStore: true }, ), ]); diff --git a/app/park/[id]/ride/[slug]/page.tsx b/app/park/[id]/ride/[slug]/page.tsx index ccb9b32..2c6fcf6 100644 --- a/app/park/[id]/ride/[slug]/page.tsx +++ b/app/park/[id]/ride/[slug]/page.tsx @@ -88,7 +88,7 @@ export default async function RideDetailPage({ params, searchParams }: PageProps let res: Response; try { res = await fetch(`${getBackendUrl()}/api/parks/${id}/rides/${slug}`, { - next: { revalidate: 60 }, + cache: "no-store", }); } catch { return ; diff --git a/lib/api.ts b/lib/api.ts index 488c20b..3b09cac 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -31,13 +31,14 @@ export function getBackendUrl(): string { */ export async function apiFetch( path: string, - options: { revalidate?: number } = {}, + options: { revalidate?: number; noStore?: boolean } = {}, ): Promise { - const { revalidate = 60 } = options; + const { revalidate = 60, noStore = false } = options; try { - const res = await fetch(`${getBackendUrl()}${path}`, { - next: { revalidate }, - }); + const res = await fetch( + `${getBackendUrl()}${path}`, + noStore ? { cache: "no-store" } : { next: { revalidate } }, + ); if (!res.ok) return null; return (await res.json()) as T; } catch {