perf: Warm docs manifests and deduplicate builds - #1242
Open
sentry[bot] wants to merge 2 commits into
Open
sentry[bot] wants to merge 2 commits into
sentry[bot] wants to merge 2 commits into
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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 | d0a64ed | Commit Preview URL Branch Preview URL |
Sep 10 2026, 11:16 AM |
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.
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.