fix: do not generate observability functions with fully prerendered routes - #4497
fix: do not generate observability functions with fully prerendered routes#4497RihanArfan wants to merge 6 commits into
Conversation
…lash-overrides # Conflicts: # src/presets/vercel/utils.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus 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 |
commit: |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/presets/vercel/utils.ts (1)
389-419: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftSplit the new prerender logic into an internal module.
src/presets/vercel/utils.tsnow exceeds 570 lines. MovegetPrerenderOverridesand the shared path normalization into a focusedsrc/presets/vercel/_prerender.tsmodule. Import that module directly where needed.As per coding guidelines, “Split logic across files; avoid long single-file modules (>200 LoC).”
Also applies to: 531-556
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/presets/vercel/utils.ts` around lines 389 - 419, Move getPrerenderOverrides and its shared path-normalization symbols, including the relevant slash and index matching constants, from utils.ts into a focused internal _prerender.ts module. Export only the symbols needed by callers, then update each usage to import them directly from _prerender.ts while preserving the existing override behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/presets/vercel/utils.ts`:
- Around line 389-419: Move getPrerenderOverrides and its shared
path-normalization symbols, including the relevant slash and index matching
constants, from utils.ts into a focused internal _prerender.ts module. Export
only the symbols needed by callers, then update each usage to import them
directly from _prerender.ts while preserving the existing override behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 70d6a6c0-6f29-4292-92db-154a664b5960
📒 Files selected for processing (5)
src/presets/vercel/utils.tstest/presets/fixtures/slash.tstest/presets/vercel.test.tstest/unit/vercel-observability-routes.test.tstest/unit/vercel-overrides.test.ts
🔗 Linked issue
Followup after #4412 is merged
❓ Type of change
📚 Description
Currently the Vercel preset creates a observability function for every route, including ones that are fully prerendered to a static file. The function takes presidence over the prerendered file with the Vercel build output so the prerendered route ends up getting SSR'd anyways.
This PR stops generating the observability route for routes that are prerendered, so they can be served.
📝 Checklist