fix(docs): keep showcase pages working without the share API - #1937
Open
ulivz wants to merge 1 commit into
Open
Conversation
Showcase list, detail and replay pages resolved every record through an external Cloudflare Worker — at build time for the list and at runtime for detail/replay — so any Worker outage blanked the list and broke every detail page. Ship the 17 public shares as a committed snapshot instead, so all three routes render from the bundle and need no network at all. The read API client and the build-time fetch plugin have no callers left and are removed; `pnpm refresh:showcase-data` regenerates the snapshot on demand.
✅ Deploy Preview for tarko ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for agent-tars-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| const tempFile = `${targetFile}.tmp`; | ||
| try { | ||
| mkdirSync(path.dirname(targetFile), { recursive: true }); | ||
| writeFileSync(tempFile, source, 'utf8'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/showcase,/showcase/:slugand/replay/:idresolved every record through theexternal share Worker — build time for the list, runtime for detail and replay.
Any Worker outage blanks the list and breaks every detail page, since those fetch on
each visit.
Change
Ship the 17 public shares as a committed snapshot (
src/data/showcaseShares.ts) andresolve list / sessionId / slug lookups from it. The build-time fetch plugin and the
now-unused share API client are removed.
pnpm refresh:showcase-dataregenerates thesnapshot on demand — manual and best-effort by design: a stale snapshot beats a site
that needs the API to be up.
Verification
Blackholed the Worker host (hosts entry, proxy bypassed, so requests fail at connect)
and rebuilt:
/showcaseAll(17) AI Browser(4) CodeAct(4) Research(4) AI Coding(3) MCP(1) General(1)/showcase/analyze-google-network-request-ea86c5Failed to Load Shared Content / Failed to fetch/replay/neo-brutalism-poster-agent-bfa30cError Loading ReplayThe snapshot matches the live API field for field (17/17, values verbatim —
urlandimageUrlkeep their scheme-less form soensureHttpsstill applies). The build outputcontains no reference to the Worker host.
Incidental fix:
extractIdFromPathtells slugs and sessionIds apart by looking for adash, so the two sessionIds that contain one (
D7wFqLQ-3eFFhxFxvlgjW,PNVJooGmZiJHpD6-5Zsfk) always 404'd on direct links. Lookups now match either field.Out of scope
lf3-static.bytednsdoc.com; only themetadata is vendored.
/zh/showcase/<slug>still 404s —theme/index.tsxandnetlify.tomlonly handlethe unprefixed
/showcaseand/replayroutes. Pre-existing.