cache queries and revalidate with incremental static regeneration
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user