fix: paper theme breadcrumbs and table overflow#48
Conversation
Replace custom breadcrumb HTML with Apsara Breadcrumb component to fix duplicate key bug causing breadcrumbs to append instead of replacing on navigation. Add className prop to shared Breadcrumbs component for theme customization. Add top margin to nested sidebar folders for visual separation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PR centralizes breadcrumb rendering logic from ChangesBreadcrumb Centralization and Navigation Styling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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
🤖 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.
Inline comments:
In `@packages/chronicle/src/themes/paper/Page.tsx`:
- Line 29: The slug derivation can produce empty segments for paths with
trailing slashes (e.g., "/guides/"), causing breadcrumb URL mismatches; update
the logic that computes slug (the const slug variable that uses pathname) to
trim leading/trailing slashes and filter out empty parts after splitting (e.g.,
split on '/' and apply .filter(Boolean) or equivalent) while preserving the root
case so pathname === '/' still yields an empty array.
🪄 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: 5e86d603-7bbd-4abb-90a9-6e79e8718fb0
📒 Files selected for processing (5)
packages/chronicle/src/components/ui/breadcrumbs.tsxpackages/chronicle/src/themes/paper/ChapterNav.module.csspackages/chronicle/src/themes/paper/ChapterNav.tsxpackages/chronicle/src/themes/paper/Page.module.csspackages/chronicle/src/themes/paper/Page.tsx
| useEffect(() => { setIsClient(true); }, []); | ||
|
|
||
| const { prev, next, crumbs } = useMemo(() => { | ||
| const slug = pathname === '/' ? [] : pathname.replace(/^\//, '').split('/'); |
There was a problem hiding this comment.
Normalize slug segments to avoid trailing-slash breadcrumb mismatches.
At Line 29, splitting pathname directly can leave empty segments (/guides/), which may produce incorrect breadcrumb URLs. Filter empty parts when deriving slug.
Suggested fix
- const slug = pathname === '/' ? [] : pathname.replace(/^\//, '').split('/');
+ const slug =
+ pathname === '/'
+ ? []
+ : pathname.replace(/^\//, '').split('/').filter(Boolean);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const slug = pathname === '/' ? [] : pathname.replace(/^\//, '').split('/'); | |
| const slug = | |
| pathname === '/' | |
| ? [] | |
| : pathname.replace(/^\//, '').split('/').filter(Boolean); |
🤖 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 `@packages/chronicle/src/themes/paper/Page.tsx` at line 29, The slug derivation
can produce empty segments for paths with trailing slashes (e.g., "/guides/"),
causing breadcrumb URL mismatches; update the logic that computes slug (the
const slug variable that uses pathname) to trim leading/trailing slashes and
filter out empty parts after splitting (e.g., split on '/' and apply
.filter(Boolean) or equivalent) while preserving the root case so pathname ===
'/' still yields an empty array.
Summary
<Breadcrumb>component — fixes duplicate key bug causing breadcrumbs to append instead of replacing on navigationclassNameprop to sharedBreadcrumbscomponent for theme customizationTest plan
🤖 Generated with Claude Code