Skip to content

perf: render package pages in full for crawlers on isr miss - #3443

Merged
danielroe merged 1 commit into
mainfrom
perf/crawlers
Nov 13, 2026
Merged

danielroe merged 1 commit into
mainfrom
perf/crawlers

Conversation

@danielroe

Copy link
Copy Markdown
Member

πŸ”— 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

@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
npmx.dev Ready Ready Preview Nov 13, 2026 12:12am UTC
2 Skipped Deployments
Project Deployment Actions Updated
docs.npmx.dev Ignored Ignored Nov 13, 2026 12:12am UTC
npmx-lunaria Ignored Ignored Nov 13, 2026 12:12am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change β†’

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

Share

Recent review info

Run configuration

Commits

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.

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… All tests successful. No failed tests found.

πŸ“’ Thoughts on this report? Let us know!

@danielroe
danielroe enabled auto-merge November 13, 2026 00:21
@danielroe
danielroe added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit ed7be46 Nov 13, 2026
36 of 37 checks passed
@danielroe
danielroe deleted the perf/crawlers branch November 13, 2026 07:50
@github-actions github-actions Bot mentioned this pull request Nov 13, 2026

This branch was successfully deployed

1 active deployment
Preview – npmx.dev β€” 93ac38ba Deployed Nov 13, 2026 by vercel[bot]
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.

2 participants