Skip to content

Commit

Permalink
fix: #128
Browse files Browse the repository at this point in the history
  • Loading branch information
zyprepare committed Feb 1, 2023
1 parent f1a3f38 commit 5c683cf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hi-ui/classic-theme",
"version": "4.0.3",
"version": "4.0.4",
"description": "Classic theme for HIUI",
"main": "./es/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useMenuCalculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const useMenuCalculator = (menu, location, history, fallback, onMenuClick, disab

const activeMenuId = useMemo(() => {
if (!currentMenu.name) {
return getNamedParent(currentMenu.path, menu).id
return getNamedParent(currentMenu.path, menu)?.id ?? ''
} else {
return currentMenu.id
}
Expand Down
1 change: 1 addition & 0 deletions src/util/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const getAncestor = (path, data, arr = []) => {
// 寻找某一节点具有 name 属性的祖先节点
export const getNamedParent = (path, data) => {
const parent = getParent(path, data)
if (!parent) return null
if (!parent.name) {
return getNamedParent(parent.path, data)
} else {
Expand Down

0 comments on commit 5c683cf

Please sign in to comment.