fix: import isAuthorRoute in page-context to prevent SSR 500s - #175
Conversation
getInitialErrorStatus() called isAuthorRoute() without importing it from route-resolver, so every unmatched route (e.g. a typo'd docs URL) crashed SSR with `ReferenceError: isAuthorRoute is not defined` and returned a 500 instead of rendering the 404 page. Added isAuthorRoute to the existing route-resolver import. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughThe page context now uses ChangesAuthor route handling
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized fix restores expected 404 responses for unmatched routes without affecting valid pages, and the supplied build, test, lint, and end-to-end checks pass; no actionable merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Symptom
Any unmatched route (e.g. a typo'd docs URL) crashed server-side rendering and returned an HTTP 500 instead of the expected 404 page.
Root cause
getInitialErrorStatus()inpackages/chronicle/src/lib/page-context.tsxcallsisAuthorRoute(route), but that function was never imported into the file — onlyresolveRoute,resolveContentRootRedirect, andRouteTypewere imported from@/lib/route-resolver. Every call hitReferenceError: isAuthorRoute is not defined, which SSR surfaced as a 500.isAuthorRouteis exported frompackages/chronicle/src/lib/route-resolver.tsand is used to detect/authorsand/authors/<slug>routes so they're excluded from the 404 status calculation.Fix
Added
isAuthorRouteto the existingroute-resolverimport:One line changed, no other files touched.
Verification
bun run build:cli— succeeds.cd packages/chronicle && bun test— 314 pass, 0 fail.cd packages/chronicle && bunx biome lint src/lib/page-context.tsx— clean.bun run dev:examples:basic):curl http://localhost:3000/docs/this-route-does-not-exist→500, withReferenceError: isAuthorRoute is not definedin the server log (stack trace pointing atgetInitialErrorStatus).404, no error in the server log.curl http://localhost:3000/docs/guides/installation→200both before and after (unaffected).🤖 Generated with Claude Code