File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,16 @@ const CBreadcrumbRouter = props => {
3939 ...attributes
4040 } = props ;
4141
42- const currPath = useLocation ( ) . pathname
43- const paths = getPaths ( currPath )
44- const currRoutes = routes . filter ( route => paths . includes ( route . path ) )
42+ let items = null
43+ if ( routes ) {
44+ const currPath = useLocation ( ) . pathname
45+ const paths = getPaths ( currPath )
46+ const currRoutes = routes . filter ( route => paths . includes ( route . path ) )
47+ items = currRoutes . map ( route => {
48+ return CBreadcrumbRouteItem ( route , currPath )
49+ } )
50+ }
51+
4552
4653 //render
4754
@@ -53,11 +60,7 @@ const CBreadcrumbRouter = props => {
5360 { ...attributes }
5461 ref = { innerRef }
5562 >
56- {
57- currRoutes . map ( route => {
58- return CBreadcrumbRouteItem ( route , currPath )
59- } )
60- }
63+ { items }
6164 </ CBreadcrumb >
6265 )
6366}
You can’t perform that action at this time.
0 commit comments