-
-
Notifications
You must be signed in to change notification settings - Fork 294
refactor: update breadcrumbs component to support dynamic title rende… #2572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: update breadcrumbs component to support dynamic title rende… #2572
Conversation
|
Caution Review failedThe pull request is closed. Summary by CodeRabbitRelease Notes
WalkthroughThis PR refactors the breadcrumb navigation system by replacing the old path-based BreadCrumbs component with a new modular architecture: BreadCrumbRenderer (presenter), BreadCrumbsWrapper (path generator), PageLayout (wrapper), and useBreadcrumbs (logic hook). Multiple page components are integrated with PageLayout, and comprehensive tests are added. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (20)
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 |
|
The PR must be linked to an issue assigned to the PR author. |
|


Tasks
/repositoriesto appear in breadcrumb as the page does not really existBreadCrumbs.tsx,BreadCrumbsWrapper.tsxResolves #(1425)
Proposed change
Display actual entity names in breadcrumbs instead of URL slugs.
Currently, breadcrumbs show URL-formatted text like "Bjornkimminich" instead of the real name "Björn Kimminich" from the database. This PR fixes that by having detail pages pass their GraphQL data to the breadcrumb system through a simple interface.
Pages now pass entity names like this:
The breadcrumb checks which field is set and displays that name. If no data is provided, it falls back to formatting the URL slug nicely.
Also refactored breadcrumb logic into reusable components (
BreadCrumbs,BreadCrumbsWrapper,useBreadcrumbshook) and added 72 tests.BEFORE
AFTER
BEFORE
AFTER
Detailed PR
Problem
Breadcrumbs were showing URL slugs instead of actual entity names from the database.
Solution
Created Reusable Breadcrumb System
Three main pieces:
BreadCrumbs.tsx- Pure UI component that renders breadcrumb items.BreadCrumbsWrapper.tsx- Renders breadcrumbs. It takes an array of items and displays them nicely with proper styling and navigation links.useBreadcrumbshook - Contains all the logic for building breadcrumbs. It handles both simple routes (/projects/zap) and nested routes (/organizations/x/repositories/y).Pages Pass Real Names via Props
Each detail page already fetches GraphQL data. Now they pass the entity name to
PageLayout:The interface accepts different entity types:
The hook checks which field is present and uses it. If none is provided, it falls back to formatting the URL slug.
Special Handling for Nested Routes
Repository routes (
/organizations/[org]/repositories/[repo]) get special detection. The breadcrumb displays actual org and repo names, and skips the "Repositories" segment since that page doesn't exist.Testing
Added 72 tests covering rendering, auto-generation, real name display, fallbacks, and edge cases. All pass.
Checklist
make check-testlocally; all checks and tests passed.