Skip to content

fix: import isAuthorRoute in page-context to prevent SSR 500s - #175

Open
rsbh wants to merge 1 commit into
mainfrom
fix/page-context-missing-isauthorroute-import
Open

fix: import isAuthorRoute in page-context to prevent SSR 500s#175
rsbh wants to merge 1 commit into
mainfrom
fix/page-context-missing-isauthorroute-import

Conversation

@rsbh

@rsbh rsbh commented Aug 27, 2026

Copy link
Copy Markdown
Member

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() in packages/chronicle/src/lib/page-context.tsx calls isAuthorRoute(route), but that function was never imported into the file — only resolveRoute, resolveContentRootRedirect, and RouteType were imported from @/lib/route-resolver. Every call hit ReferenceError: isAuthorRoute is not defined, which SSR surfaced as a 500.

isAuthorRoute is exported from packages/chronicle/src/lib/route-resolver.ts and is used to detect /authors and /authors/<slug> routes so they're excluded from the 404 status calculation.

Fix

Added isAuthorRoute to the existing route-resolver import:

-import { resolveRoute, resolveContentRootRedirect, RouteType } from '@/lib/route-resolver';
+import { resolveRoute, resolveContentRootRedirect, RouteType, isAuthorRoute } from '@/lib/route-resolver';

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.
  • Reproduced end-to-end against the dev server (bun run dev:examples:basic):
    • Before fix: curl http://localhost:3000/docs/this-route-does-not-exist500, with ReferenceError: isAuthorRoute is not defined in the server log (stack trace pointing at getInitialErrorStatus).
    • After fix: same request → 404, no error in the server log.
    • Valid page curl http://localhost:3000/docs/guides/installation200 both before and after (unaffected).

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
chronicle Ready Ready Preview Aug 27, 2026 5:49am

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 10c2374c-0d73-4152-b23e-73baee13c3d3

📥 Commits

Reviewing files that changed from the base of the PR and between a26adf4 and 98e01bd.

📒 Files selected for processing (1)
  • packages/chronicle/src/lib/page-context.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Author pages are no longer incorrectly treated as error routes during initial page loading.

Walkthrough

The page context now uses isAuthorRoute to return no initial error status for author routes.

Changes

Author route handling

Layer / File(s) Summary
Author route error status
packages/chronicle/src/lib/page-context.tsx
getInitialErrorStatus now treats author routes as non-error routes by returning null.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 98e01

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: rohilsurana

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the import fix and its purpose of preventing SSR 500 errors. It accurately reflects the main change.
Description check ✅ Passed The description directly explains the SSR 500 symptom, the missing import root cause, the one-line fix, and the verification results. It is related to the changeset.
Docstring Coverage ✅ Passed 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…
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: Docstring Coverage

Explanation

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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/page-context-missing-isauthorroute-import

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

Comment @coderabbitai help to get the list of available commands.

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.

1 participant