From 9e8a876cd1b22897cff1eac69077a64c062d2db4 Mon Sep 17 00:00:00 2001 From: Sluijsens Date: Sun, 15 Nov 2026 13:54:11 +0100 Subject: [PATCH] Notes that CMS scheduling applies at build time and live in the browser Co-Authored-By: Claude Sonnet 5.5 --- docs/cms-integration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/cms-integration.md b/docs/cms-integration.md index 8079a82..20f58ab 100644 --- a/docs/cms-integration.md +++ b/docs/cms-integration.md @@ -12,6 +12,7 @@ Source: `GET /api/v1/offerings`. One list feeds the price cards on the home page 1. At build time `web/config/fetchOfferings.ts` (the first step of `pnpm build`) asks `OFFERINGS_URL` (10 s timeout, 2 attempts) and writes the gitignored `web/src/content/offerings.generated.json`. The packages are baked into the prerendered HTML (search engines see the prices, no layout jump). 2. Without `OFFERINGS_URL`, with a CMS that is down or with an unusable answer, the committed `web/src/content/offerings.snapshot.json` is used. The build never fails and never shows empty prices; the log says which source was used. Tests always use the snapshot. 3. After hydration `PackagesProvider` (`web/src/components/PackagesProvider/`) asks the CMS once and replaces the baked list only if the answer differs. A network error, time-out (8 s), bad status or invalid answer keeps what was baked. A change in the CMS therefore shows at once; the nightly build only matters for search engines. +- **Scheduling in the CMS:** the API only returns packages that are live at the moment of the request (switched on and inside their from/to dates), so the site shows them and nothing else. The baked list reflects the moment of the build; the live refresh after hydration corrects it for every visitor, and the nightly build corrects it for search engines. A package that goes live or expires between two builds is therefore right in the browser but can be stale in the HTML until the next build. - **Keep the snapshot current** when the real packages change (prices, features), because production builds use it (see "Reverse proxy" below). ## Banners (OfferingBanner)