Skip to content

Commit

Permalink
Merge pull request #129 from hiui-group/hotfix/#128
Browse files Browse the repository at this point in the history
fix: #128
  • Loading branch information
solarjoker authored Feb 1, 2023
2 parents f1a3f38 + 5c683cf commit 8867d49
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 8867d49

Please sign in to comment.