fix: homepage rendering and client-side navigation issues#32
Conversation
Nitro's [...slug] catch-all doesn't match empty path /api/page/. Re-export the catch-all handler as index.ts so the homepage API route works for both index.md and README.md variants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use page.slug from context instead of route slug so breadcrumbs and content update together when the fetch completes, avoiding flicker. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Local links now use ApsaraLink with onClick + useNavigate instead of RouterLink, ensuring consistent styling across internal and external links. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 32 minutes and 39 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Link component is refactored to use programmatic navigation via Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/chronicle/src/pages/DocsPage.tsx (1)
33-33: KeepjsonLd.urlconsistent with the same slug source.Good change on Line 33. To avoid transient metadata/content mismatch during navigation, compute
pageUrlfrompage.slugas well (currently Line 15 uses routeslug).Suggested patch
- const pageUrl = config.url ? `${config.url}/${slug.join('/')}` : undefined; + const pageUrl = config.url ? `${config.url}/${page.slug.join('/')}` : undefined;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/chronicle/src/pages/DocsPage.tsx` at line 33, The jsonLd.url should be built from the same slug source as the page metadata to avoid mismatches: change the code that computes pageUrl (currently using the route slug) to use page.slug instead, and update any uses of jsonLd.url to reference that pageUrl; look for variables named pageUrl, jsonLd, and page.slug in DocsPage (and any nearby slug/route variables) and ensure pageUrl is derived from page.slug before assigning jsonLd.url.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/chronicle/src/components/mdx/link.tsx`:
- Around line 38-45: The current onClick handler unconditionally calls
preventDefault and overrides caller handlers; update the onClick for ApsaraLink
to (1) early-return to preserve native semantics when the event is already
defaultPrevented, when e.metaKey/e.ctrlKey/e.shiftKey or e.altKey are true, or
when e.button !== 0 (non-left/middle clicks), (2) call props.onClick(event) if
present before deciding to preventDefault/navigate and respect its
defaultPrevented result, (3) only call event.preventDefault() and navigate(href)
for plain left-clicks without modifiers, and (4) change the JSX to spread
{...props} before specifying onClick (so our handler isn't accidentally
overridden) while still forwarding children via ApsaraLink.
---
Nitpick comments:
In `@packages/chronicle/src/pages/DocsPage.tsx`:
- Line 33: The jsonLd.url should be built from the same slug source as the page
metadata to avoid mismatches: change the code that computes pageUrl (currently
using the route slug) to use page.slug instead, and update any uses of
jsonLd.url to reference that pageUrl; look for variables named pageUrl, jsonLd,
and page.slug in DocsPage (and any nearby slug/route variables) and ensure
pageUrl is derived from page.slug before assigning jsonLd.url.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ba184881-8fce-4770-8c0a-09e7e77f33e5
📒 Files selected for processing (3)
packages/chronicle/src/components/mdx/link.tsxpackages/chronicle/src/pages/DocsPage.tsxpackages/chronicle/src/server/api/page/index.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
/api/page/during client-side navigation to homepage by adding index route handler that re-exports the catch-all handlerpage.slugfrom context instead of route slugTest plan
index.mdxtoREADME.md— homepage still resolves🤖 Generated with Claude Code