Commit 6b1aab9c by Jin Mao Committed by GitHub

fix: handle undefined children in generate-menus (#6117)

When children is undefined, use empty array as fallback to prevent potential runtime errors. This matches the behavior when hideChildrenInMenu is true.
1 parent 8f4d3d41
......@@ -51,7 +51,7 @@ function generateMenus(
// 处理子菜单
const resultChildren = hideChildrenInMenu
? []
: (children as MenuRecordRaw[]);
: ((children as MenuRecordRaw[]) ?? []);
// 设置子菜单的父子关系
if (resultChildren.length > 0) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!