Repository navigation
perf: Warm docs manifests and deduplicate builds - #1242
sentry[bot] wants to merge 3 commits into
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
tanstack-com | 4ffd44e | Commit Preview URL Branch Preview URL |
Oct 20 2026, 12:26 PM |
|
|
The cache warming is worth keeping, but we can use the cache's existing request deduplication. I pushed a follow-up that also tightens validation of cached manifests.
|
This PR addresses an N+1 API call issue occurring on docs pages (
/_library/$libraryId/$version/docs/$).Problem:
When navigating to a docs page, the
fetchDocsManifestserver function was triggering hundreds of individual HTTP calls to GitHub's content API. This happened becausebuildDocsManifest(whichfetchDocsManifestuses) iterates over every markdown file in a library's docs directory and fetches each one individually to extract frontmatter redirect metadata. While a cache (getCachedDocsArtifact) exists, the GitHub webhook handler (src/routes/api/github/webhook.ts) only marked these artifacts as stale, rather than proactively rebuilding them. Consequently, the first user request after a cache invalidation (or on a cold server start) would incur the full N+1 cost.Solution:
warmDocsArtifacts(src/utils/docs-warm.server.ts), is introduced. After the GitHub webhook handler marks docs artifacts stale, it now callswarmDocsArtifactsin a background task. This rebuilds both the main docs manifest and the docs path manifest immediately, ensuring the cache is warm before subsequent user requests.buildDocsManifestnow includes in-flight deduplication. If multiple concurrent requests attempt to build the same manifest (e.g., during a cold server start), only one build process will execute, and all other pending requests will await and share its result. This prevents redundant GitHub API calls in high-concurrency scenarios.These changes ensure that docs manifests are always served from a warm cache, significantly reducing the number of outbound GitHub API calls and improving page load performance.
Fixes TANSTACK-COM-4D2
This PR was automatically generated by Sentry. You can adjust this setting at any time.