File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ const getPaths = pathname => {
1616 return paths
1717}
1818
19- const CBreadcrumbRouteItem = ( { name, path } , currPath ) => {
20- if ( path === currPath ) {
21- return < CBreadcrumbItem key = { path } active > { name } </ CBreadcrumbItem >
19+ const CBreadcrumbRouteItem = ( { name, currPath } , fullCurrPath ) => {
20+ if ( currPath === fullCurrPath ) {
21+ return < CBreadcrumbItem key = { currPath } active > { name } </ CBreadcrumbItem >
2222 } else {
23- return < CBreadcrumbItem key = { path } >
24- < Link to = { path } >
23+ return < CBreadcrumbItem key = { currPath } >
24+ < Link to = { currPath } >
2525 { name }
2626 </ Link >
2727 </ CBreadcrumbItem >
@@ -41,11 +41,12 @@ const CBreadcrumbRouter = props => {
4141 if ( routes ) {
4242 const currPath = useLocation ( ) . pathname
4343 const paths = getPaths ( currPath )
44- const currRoutes = paths . map ( path => {
45- return routes . find ( route => matchPath ( path , {
44+ const currRoutes = paths . map ( currPath => {
45+ const route = routes . find ( route => matchPath ( currPath , {
4646 path : route . path ,
4747 exact : route . exact
4848 } ) )
49+ return { ...route , currPath }
4950 } ) . filter ( route => route )
5051 items = currRoutes . map ( route => {
5152 return CBreadcrumbRouteItem ( route , currPath )
You can’t perform that action at this time.
0 commit comments