Skip to content

Centralize dynamic-rendering opt-out in fetchAPI instead of per-page - #204

Merged
calebyhan merged 1 commit into
mainfrom
#201/centralize-force-dynamic-cache
Aug 21, 2026
Merged

Centralize dynamic-rendering opt-out in fetchAPI instead of per-page#204
calebyhan merged 1 commit into
mainfrom
#201/centralize-force-dynamic-cache

Conversation

@calebyhan

Copy link
Copy Markdown
Contributor

Summary

  • fetchAPI never set cache: "no-store", so Next statically froze data at build time unless a page remembered to add export const dynamic = "force-dynamic"; — that line had been duplicated across 16 files with nothing enforcing it, and kept getting reintroduced page-by-page (Staff & Leadership frontends not updating #191, Fix finance hearing banner copy on homepage #192, Fix stale staff, leadership, and funding hearing pages #196).
  • Set cache: "no-store" as the default in fetchAPI itself (still overridable per-call via options), so any page calling an API getter is dynamic automatically.
  • Removed the now-redundant export const dynamic = "force-dynamic"; from all 16 pages, since none of them rely on cookies/headers for dynamic behavior — they all get it from fetchAPI now.

Fixes #201

Test plan

  • tsc --noEmit passes
  • Frontend build passes
  • Verify a page reading admin-edited data (e.g. senators) reflects an edit without a rebuild

Every page reading admin-editable data needed export const dynamic =
"force-dynamic" or it would silently serve build-time-stale data, and
that line was duplicated across 16 files with nothing enforcing it —
new pages kept forgetting it (#191, #192, #196). Set cache: "no-store"
as the default in fetchAPI itself so any page calling an API getter
is dynamic automatically, then drop the now-redundant per-page
exports.

Fixes #201
@github-actions

Copy link
Copy Markdown

Test Results

573 tests  ±0   573 ✅ ±0   44s ⏱️ -5s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 3e434f6. ± Comparison against base commit 9526ecc.

@calebyhan
calebyhan marked this pull request as ready for review August 21, 2026 01:11

@MasonMines2006 MasonMines2006 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@calebyhan
calebyhan merged commit b510850 into main Aug 21, 2026
3 checks passed
@calebyhan
calebyhan deleted the #201/centralize-force-dynamic-cache branch August 21, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Centralize force-dynamic cache config instead of duplicating it per-page

2 participants