@@ -5,7 +5,7 @@ import { useMemo } from 'react';
55
66export 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