Skip to content

Commit 690fe5c

Browse files
committed
Upcoming, theme pages and the sitemap render per request, not from the build
The Docker build has no backend. Because /upcoming no longer read searchParams, Next prerendered it at build time, so the first five minutes after every deploy served "Upcoming dates are unavailable"; /upcoming/[theme] served "no dates" (and a noindex robots tag), and the sitemap listed only the six fixed pages until its hourly window passed. That is also why the last two deploys were rolled back: the deploy's /upcoming probe polls for data-upcoming-count and never saw it. All three now use force-dynamic. Their data reads keep their 60-second cache, and dynamicParams=false still 404s politics and natural-disasters. Verified in a local production build: /upcoming has data-upcoming-count="72", the finance page lists 72 rows, the sitemap has 43 URLs (33 events, 2 themes, 2 year pages), /upcoming/politics is 404, and an event page is indexable.
1 parent 3eda816 commit 690fe5c

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎frontend/src/app/(engine)/upcoming/[theme]/page.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import { archiveCount, getEventsHealth, getUpcoming } from "@/lib/seo/data";
1111
import { themePageGraph } from "@/lib/seo/graphs";
1212
import { SITE_NAME, urlFor } from "@/lib/seo/site";
1313

14-
export const revalidate = 300;
14+
// Rendered per request, not prerendered at build: the Docker build has no backend, so a
15+
// prerendered copy would serve "no dates" and a noindex robots tag for its revalidate window
16+
// after every deploy. dynamicParams=false still 404s politics and natural-disasters.
17+
export const dynamic = "force-dynamic";
1518
export const dynamicParams = false;
1619

1720
// Only the three themes with pages. Politics and Natural Disasters are not

‎frontend/src/app/(engine)/upcoming/page.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { orderedThemes, type OrderedTheme } from "@/lib/events/upcoming";
99
import { getUpcoming, type UpcomingEventPayload } from "@/lib/seo/data";
1010
import { absoluteUrl, SITE_NAME } from "@/lib/seo/site";
1111

12-
export const revalidate = 300;
12+
// Rendered per request, not prerendered at build: the Docker build has no backend, so a
13+
// prerendered copy would serve "unavailable" (or no dates) for its revalidate window after
14+
// every deploy. The data reads themselves keep a 60-second cache.
15+
export const dynamic = "force-dynamic";
1316

1417
const TITLE = "Upcoming dates · StrikeHike";
1518
const DESCRIPTION =

‎frontend/src/app/sitemap.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import {
1414
} from "@/lib/seo/data";
1515
import { CONTENT_DATES, absoluteUrl, urlFor, type SitePath } from "@/lib/seo/site";
1616

17-
// Regenerated at most hourly on the server. A build without CHRONO_API_URL lists the copy dates;
18-
// the first regeneration with data adds the data dates and the generated pages.
19-
export const revalidate = 3600;
17+
// Generated per request: the Docker build has no backend, so a prerendered copy would list
18+
// only the fixed pages until its revalidate window passed. The data reads are cached for 60 s.
19+
export const dynamic = "force-dynamic";
2020

2121
// ISO dates (YYYY-MM-DD) compare as strings.
2222
const later = (a: string, b?: string | null) => (b && b > a ? b : a);

0 commit comments

Comments
 (0)