You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf: render package pages in full for crawlers on isr miss - #3443
for faster perf, we serve a shell that gets filled in on the client, but this has a cost (we have to render twice) - and we can skip the cost for crawlers, who don't care about the speed of the initial render
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
New Features
Crawler requests now use a dedicated fallback route, while browser requests continue to use the existing page route.
The crawler-specific fallback configuration is created automatically when fallback files are generated. This provides separate handling for crawler and browser traffic without changing the browser-facing route.
The Vercel compiled hook now configures a crawler function after generating fallback files. It adds a crawler-specific prerender configuration and route, and tests verify the generated files, route selection, and missing-route error.
Changes: Crawler fallback routing
Layer / File(s)
Summary
Create and validate crawler fallback routing modules/isr-fallback.ts, test/unit/modules/isr-fallback.spec.ts
The compiled hook invokes addCrawlerFunction. That function writes a prerender configuration without fallback, links the crawler function to __fallback.func, and inserts a crawler user-agent route before the package ISR route. Tests check the generated configuration, crawler and browser route selection, and the error when the expected route is absent.
Possibly related issues
npmx-dev/npmx.dev#3382 β The change affects crawler requests only. Human visitors still receive the ISR fallback shell, so the reported first-visit redirect behaviour remains unresolved.
npmx-dev/npmx.dev#1602 β The crawler route changes the fallback path for crawler requests only. The reported first-visit behaviour for other requests remains unresolved.
Suggested reviewers:serhalp
Merge Risk: Minimal Β· up to 93ac3
Crawler requests that miss the ISR cache get a fully rendered package page, and the default Vercel build produces the files this change needs. A possible build failure exists only if someone runs a static generate on Vercel, which this repository does not configure. No merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title states the main change: package pages are rendered in full for crawlers when there is an ISR cache miss. The perf: prefix fits the stated goal of faster page delivery for users. The title isβ¦
Description check
The description explains the reason for the change. It states that the current shell approach requires rendering twice, and that crawlers can skip this cost because they do not depend on the speed of β¦
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title states the main change: package pages are rendered in full for crawlers when there is an ISR cache miss. The perf: prefix fits the stated goal of faster page delivery for users. The title is specific and matches the summary of the modules/isr-fallback.ts changes, which add a crawler-specific route that targets the crawler function.
Full details: Description check
Explanation
The description explains the reason for the change. It states that the current shell approach requires rendering twice, and that crawlers can skip this cost because they do not depend on the speed of the initial render. This relates directly to the crawler route and fallback changes. The linked issue section still contains the template placeholder text and no issue number, but the check is lenient and the context section is on-topic.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between 030933d and 93ac38b.
Files selected for processing: 2
modules/isr-fallback.ts
test/unit/modules/isr-fallback.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
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
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.
π Linked issue
π§ Context
for faster perf, we serve a shell that gets filled in on the client, but this has a cost (we have to render twice) - and we can skip the cost for crawlers, who don't care about the speed of the initial render