Skip to content

feat(content): serve sheet content from the server with cache components - #42

Merged
maxitect merged 17 commits into
mainfrom
feat/27-serve-google-sheets-content-from-the-server-with
Nov 12, 2026
Merged

maxitect merged 17 commits into
mainfrom
feat/27-serve-google-sheets-content-from-the-server-with

Conversation

@maxitect

@maxitect maxitect commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

About, Music, Tour and Lyrics now get their Google Sheet content on the server from cached readers, so the HTML contains the content and visitors' browsers no longer call Google.

Changes

  • cacheComponents: true; each sheet tab is read by a cached function in src/lib/data/content.ts (Next's minutes profile) that pages, sitemap.xml, llms.txt and the .md pages share
  • Pages pass both languages to their client component as props; the fetch effects and their console.log calls are gone
  • Tour dates are split into past and upcoming at request time, outside the cache
  • The sheet URL is read from the server-only SHEET_CSV_URL
  • Carried over from the Spike: Payload with Neon and Cache Components on Netlify's free plan #32 spike: site routes moved into a (frontend) route group (ready for Payload's admin in Replace the Google Sheet with Payload for site content #33), database rules for Payload collections, the payload-collection skill, and INSTRUCTIONS.md updates

Acceptance criteria

AC Result Method Evidence
/tour HTML contains the tour dates, not "Loading..." PASS deploy AC1 below
No browser request to docs.google.com on any page PASS deploy, browser AC2 below
A sheet edit shows within the cache lifetime, no redeploy PASS deploy AC3 below
Language toggle switches content without a reload PASS deploy, browser AC4 below
pnpm lint, pnpm typecheck and pnpm build pass PASS cli AC5 below
Works on the Netlify deploy preview PASS deploy AC1 to AC4 ran on https://deploy-preview-42--clarksbowlingclub.netlify.app

Closes

Closes #27

Notes

  • SHEET_CSV_URL is set on Netlify for every context (production, deploy previews, branch deploys, dev). NEXT_PUBLIC_CSV_URL can be removed from Netlify after the merge.
  • CI reads the GitHub Actions repository variable SHEET_CSV_URL, because pages are now prerendered from the sheet. The URL is not a secret: it was in the browser bundle as NEXT_PUBLIC_CSV_URL.
  • Builds now depend on Google answering. A sheet read fails, and is not cached, when Google answers with an error status, with anything other than text/csv, without one of the two language columns, or not within 8 seconds. At build time that fails the build rather than publishing empty pages; at run time the last good page keeps being served. A throttled sheet (as on 11 November) blocks a deploy, not the live site.
  • Not covered: once the tour dates' cache entry has expired (one hour), a failing sheet makes the dates section of /tour error, because it is read per request and has no error boundary. Recorded for a later ticket.
  • /tour is partly prerendered: the title and intro are static, the dates stream in from a function on each request, so the past and upcoming split is never cached. That is one function call per /tour view against the 125,000 a month.
  • /sitemap.xml and /llms.txt are rendered on request from the cached readers (0.27 to 0.75 s on the preview).
  • The 17 react-hooks lint errors named in the issue were already gone on main; pnpm lint reports none.
  • The route move changes the icon and Open Graph image URLs to hashed paths (/icon-4usi79.svg); nothing links the old ones.
  • Fixed after review: tour dates are built and formatted in UTC, so visitors west of UTC no longer get a hydration error (and no longer see the day before, a bug production has today); the footer is rendered on the server again with a cached year, where <Suspense> had left it out of every static page's HTML; README and INSTRUCTIONS.md name SHEET_CSV_URL and the (frontend) paths.
  • Behaviour change: the chosen music category and lyrics album now survive a language switch; production resets them.
  • For a later ticket: an empty sheet tab now leaves a permanent "Loading..." in the HTML and needs a real empty state; /sitemap.xml runs a function on every request and could be cached.
  • Scope carried in from the Spike: Payload with Neon and Cache Components on Netlify's free plan #32 spike at the user's request: the (frontend) route group, .claude/rules/database.md, the payload-collection skill and the INSTRUCTIONS.md edits. Payload itself is not in this PR; it stays on feat/32-spike-payload-with-neon-and-cache-components-on for Replace the Google Sheet with Payload for site content #33.
Evidence

AC1

$ curl -s https://deploy-preview-42--clarksbowlingclub.netlify.app/tour | grep -c 'Loading'
0
$ curl -s …/tour | grep -o '<time' | wc -l
11
$ curl -s …/tour | grep -o 'Lyon, FR' | wc -l
9
/about, /music, /lyrics: grep -c 'Loading' -> 0 each

AC2

Playwright on the preview, pages /, /about, /music, /tour, /lyrics, /merch, /contact, /privacy-policy,
then the four content pages again at 1280px and 390px in English and French:
requests matching docs.google.com or googleusercontent: []
console errors: []

AC3

The user edited the Tour tab's English intro in the sheet ("Come and see" to "Come n see"), no redeploy.
21:45:57  curl -s <preview>/tour | grep -o 'Come[^!]*!'
Come n see Clark&#x27;s Bowling Club play live, we can&#x27;t wait to see you!
(same at 21:46:18 and 21:46:39)

$ pnpm build
├ ○ /about     Revalidate 1m  Expire 1h
├ ○ /lyrics    Revalidate 1m  Expire 1h
├ ○ /music     Revalidate 1m  Expire 1h
├ ◐ /tour      Revalidate 1m  Expire 1h

$ curl -s …/about   (second request, headers)
cache-status: "Netlify Durable"; hit; ttl=58
cache-status: "Next.js"; hit

Review fixes

Tour dates after the UTC fix, local production build, three time zones:
America/New_York  05 Jul 2025, 04 Jul 2025, 21 Jun 2025 (11 dates)  errors []
Europe/Paris      05 Jul 2025, 04 Jul 2025, 21 Jun 2025 (11 dates)  errors []
Pacific/Auckland  05 Jul 2025, 04 Jul 2025, 21 Jun 2025 (11 dates)  errors []
Server HTML: <time dateTime="2025-07-05">05 Jul 2025 … <time dateTime="2024-06-28">28 Jun 2024

Footer in prerendered HTML (grep -c 'All rights reserved'): index 1, about 1, music 1, lyrics 1, contact 1

On the preview after the fixes:
curl -s <preview>/{,about,music,lyrics,contact} | grep -c 'All rights reserved' -> 1 each
/tour in America/New_York and Europe/Paris: 05 Jul 2025, 04 Jul 2025, 21 Jun 2025, pageerror []

AC4

Toggle clicked on each page, main-frame navigations counted:
/about   "About | Clark's Bowling Club is a 6-piece funk/pop band…" -> "Bio | Clark's Bowling Club est un groupe de funk/pop…", navigations 0, <html lang="fr">
/music   "Music | Live Performances | Music Videos…" -> "Musique | Clips Live | Clips Vidéo…", navigations 0
/tour    "Tour | Come and see Clark's Bowling Club play live…" -> "Tournée | Venez voir Clark's Bowling Club en live…", navigations 0
/lyrics  "Lyrics | … Songs from Cool Kids album" -> "Paroles | … Chansons de l'album Cool Kids", navigations 0
Screenshots: .git/ticket/27/artefacts/{about,music,tour,lyrics}-{1280,390}-{en,fr}.png

AC5

$ .claude/skills/ticket/scripts/check.sh
CHECK PASS: lint typecheck build

GitHub Actions, check job, after the repository variable was added and the job re-run:
check  pass  35s

@netlify

netlify Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for clarksbowlingclub ready!

Name Link
🔨 Latest commit f8361ee
🔍 Latest deploy log https://app.netlify.com/projects/clarksbowlingclub/deploys/6af62e0092b631f10cfff9b5
😎 Deploy Preview https://deploy-preview-42--clarksbowlingclub.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@maxitect
maxitect merged commit ffdce21 into main Nov 12, 2026
5 of 6 checks passed
@maxitect
maxitect deleted the feat/27-serve-google-sheets-content-from-the-server-with branch November 12, 2026 22:11
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.

Serve Google Sheets content from the server with Cache Components

1 participant