Skip to content

Commit f02102d

Browse files
committed
fix: Breadcrumbs memo dependencies are now accurate
1 parent 0eac824 commit f02102d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/components/Breadcrumbs.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useMemo } from 'react';
55

66
export function Breadcrumbs() {
77
const location = useLocation();
8-
const routeContext = useRouteContext({ strict: false });
8+
const { organization, instance, cluster } = useRouteContext({ strict: false });
99
const breadcrumbs = useMemo(() => {
1010
const routeHistory = location.pathname.split('/')
1111
.filter((x) => x && x.length > 0);
@@ -32,16 +32,16 @@ export function Breadcrumbs() {
3232
index += 2;
3333
} else if (name.startsWith('Org ')) {
3434
// id = route.split('org-').pop();
35-
name = routeContext?.organization?.name || 'Org';
35+
name = organization?.name || 'Org';
3636
} else if (name.startsWith('Clu ')) {
3737
// id = route.split('clu-').pop();
38-
name = routeContext?.cluster?.name || 'Cluster';
38+
name = cluster?.name || 'Cluster';
3939
if (routeHistory[index + 1] === 'instance') {
4040
path += '/instances';
4141
}
4242
} else if (name.startsWith('Ins ')) {
4343
// id = route.split('ins-').pop();
44-
name = routeContext?.instance?.name?.split('.')?.shift() || 'Instance';
44+
name = instance?.name?.split('.')?.shift() || 'Instance';
4545
}
4646

4747
breadcrumbs.push(
@@ -59,8 +59,7 @@ export function Breadcrumbs() {
5959
}
6060

6161
return breadcrumbs;
62-
}, [location.pathname, routeContext?.cluster?.name, routeContext?.organization?.name]);
63-
62+
}, [location.pathname, cluster?.name, instance?.name, organization?.name]);
6463

6564
return (
6665
<div role="list" className="flex items-center space-x-0 lg:space-x-2 xl:space-x-4 sm:max-w-9/10 max-w-[calc(100%-56px)]">

0 commit comments

Comments
 (0)