cache queries and revalidate with incremental static regeneration

This commit is contained in:
2026-07-07 02:32:21 +02:00
parent d63b14b2e5
commit e600d0a663
22 changed files with 381 additions and 114 deletions
+8 -1
View File
@@ -8,6 +8,7 @@ import {
} from "date-fns";
import { getClient } from "@/app/client";
import { cachedUntilOsloMidnight } from "@/lib/revalidation";
import { graphql, unmaskFragment } from "@/gql";
import type {
OpeningHoursRangeBlockFragment as OpeningHoursRangeBlock,
@@ -50,7 +51,13 @@ const openingHoursQuery = graphql(`
`);
export async function fetchOpeningHoursSets() {
const { data, error } = await getClient().query(openingHoursQuery, {});
const { data, error } = await getClient().query(
openingHoursQuery,
{},
// The footer renders today's hours on every page, so this TTL doubles as
// the sitewide midnight refresh for futureEvents rollover
cachedUntilOsloMidnight()
);
const sets = (data?.openingHoursSets ?? []) as OpeningHoursSet[];
return sets;
}