浏览代码

fix #2630,Fix problems with first level menu matching

陈帅 7 年之前
父节点
当前提交
f473b000f7
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      src/components/SiderMenu/BaseMenu.js

+ 7 - 4
src/components/SiderMenu/BaseMenu.js

@@ -24,10 +24,13 @@ const getIcon = icon => {
   return icon;
 };
 
-export const getMenuMatches = memoizeOne(
-  (flatMenuKeys, path) => flatMenuKeys.filter(item => item && pathToRegexp(item).test(path)),
-  isEqual
-);
+export const getMenuMatches = (flatMenuKeys, path) =>
+  flatMenuKeys.filter(item => {
+    if (item) {
+      return pathToRegexp(item).test(path);
+    }
+    return false;
+  });
 
 export default class BaseMenu extends PureComponent {
   constructor(props) {