Skip to content

Commit

Permalink
fix: remove breadcrumbs with empty title (#1445)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored Sep 11, 2024
1 parent 1beaaf0 commit 7a5939a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/fdr-sdk/src/navigation/utils/createBreadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ export function createBreadcrumbs(nodes: NavigationNode[]): readonly NavigationB
});
});

return breadcrumb;
// Remove breadcrumbs with empty titles
return breadcrumb.filter((item) => item.title.trim().length > 0);
}
5 changes: 3 additions & 2 deletions packages/ui/app/src/components/FernBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ export interface FernBreadcrumbsProps {

export function FernBreadcrumbs({ breadcrumbs }: FernBreadcrumbsProps): ReactElement | null {
const toHref = useToHref();
const filteredBreadcrumbs = breadcrumbs.filter((item) => item.title.trim().length > 0);

if (breadcrumbs.length === 0) {
if (filteredBreadcrumbs.length === 0) {
return null;
}
return (
<div>
<span className="fern-breadcrumbs">
{breadcrumbs.map((breadcrumb, idx) => (
{filteredBreadcrumbs.map((breadcrumb, idx) => (
<Fragment key={idx}>
{idx > 0 && <NavArrowRight className="fern-breadcrumbs-arrow" />}
{breadcrumb.pointsTo != null ? (
Expand Down

0 comments on commit 7a5939a

Please sign in to comment.