From db6ad46367a243d6c033ba866bb694475ef35963 Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Wed, 11 Sep 2024 02:25:37 -0400 Subject: [PATCH 1/2] fix: remove breadcrumbs with empty title --- packages/fdr-sdk/src/navigation/utils/createBreadcrumbs.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/fdr-sdk/src/navigation/utils/createBreadcrumbs.ts b/packages/fdr-sdk/src/navigation/utils/createBreadcrumbs.ts index b53da9c071..40371b4e26 100644 --- a/packages/fdr-sdk/src/navigation/utils/createBreadcrumbs.ts +++ b/packages/fdr-sdk/src/navigation/utils/createBreadcrumbs.ts @@ -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); } From dee337063710d62648a6156648d5cb7df48a7afe Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Wed, 11 Sep 2024 02:27:31 -0400 Subject: [PATCH 2/2] fix at component level --- packages/ui/app/src/components/FernBreadcrumbs.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/ui/app/src/components/FernBreadcrumbs.tsx b/packages/ui/app/src/components/FernBreadcrumbs.tsx index 5a14958711..5871213edf 100644 --- a/packages/ui/app/src/components/FernBreadcrumbs.tsx +++ b/packages/ui/app/src/components/FernBreadcrumbs.tsx @@ -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 (
- {breadcrumbs.map((breadcrumb, idx) => ( + {filteredBreadcrumbs.map((breadcrumb, idx) => ( {idx > 0 && } {breadcrumb.pointsTo != null ? (