Browse Source

Fix当hideInBreadcrumb==true,面包屑报错的问题 (#3984)

* fix hideInBreadcrumb==true error

* update for ci
耐小心 6 years ago
parent
commit
23d00abbc8
1 changed files with 16 additions and 14 deletions
  1. 16 14
      src/components/PageHeaderWrapper/breadcrumb.js

+ 16 - 14
src/components/PageHeaderWrapper/breadcrumb.js

@@ -61,20 +61,22 @@ const conversionFromLocation = (routerLocation, breadcrumbNameMap, props) => {
   // Convert the url to an array
   const pathSnippets = urlToList(routerLocation.pathname);
   // Loop data mosaic routing
-  const extraBreadcrumbItems = pathSnippets.map(url => {
-    const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url);
-    if (currentBreadcrumb.inherited) {
-      return null;
-    }
-    const name = renderItemLocal(currentBreadcrumb);
-    const { hideInBreadcrumb } = currentBreadcrumb;
-    return name && !hideInBreadcrumb
-      ? {
-          path: url,
-          breadcrumbName: name,
-        }
-      : null;
-  });
+  const extraBreadcrumbItems = pathSnippets
+    .map(url => {
+      const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url);
+      if (currentBreadcrumb.inherited) {
+        return null;
+      }
+      const name = renderItemLocal(currentBreadcrumb);
+      const { hideInBreadcrumb } = currentBreadcrumb;
+      return name && !hideInBreadcrumb
+        ? {
+            path: url,
+            breadcrumbName: name,
+          }
+        : null;
+    })
+    .filter(item => item !== null);
   // Add home breadcrumbs to your head if defined
   if (home) {
     extraBreadcrumbItems.unshift({