fix(building-passport): don't cache property-meta fetch

getPropertyMeta self-fetched /api/property-meta with revalidate:60 (despite a
comment saying it shouldn't cache). Vercel's Data Cache served a stale response
from before the headline backfill, so the current EPC rating / SAP rendered
blank on the plans and plan-detail pages even though the API now returns them.
Use cache:"no-store" so backfilled headline values propagate immediately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-17 14:31:38 +00:00
parent a184127cd4
commit e1d56cc773

View file

@ -242,11 +242,13 @@ export async function getPropertyMeta(
): Promise<PropertyMeta> {
const url = process.env.URL + `/api/property-meta/${propertyId}`;
// Note, for the moment, we don't cache the data
// Don't cache: property meta (incl. headline SAP/EPC, which is now backfilled
// from the baseline table) changes as the modelling pipeline writes data, and
// a stale Data Cache entry was causing the current rating to render blank.
const response = await fetch(url, {
method: "GET",
headers: { "Content-Type": "application/json" },
next: { revalidate: 60 },
cache: "no-store",
});
if (!response.ok) {
throw new Error("Network response was not ok");