Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](Nav): Fix menu children errors #518

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/base/src/page/Nav/SideMenu/MenuList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
// #endif
const filterMenusByPermissions = (requiredMenus: CustomMenuItemType[]) => {
return requiredMenus.filter((menu) => {
if (menu?.permission) {
return checkPagePermission(menu.permission);
}

if ((menu as SubMenuType).children) {
if ((menu as SubMenuType)?.children) {

Check warning on line 32 in packages/base/src/page/Nav/SideMenu/MenuList/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 32 in packages/base/src/page/Nav/SideMenu/MenuList/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
(menu as SubMenuType).children = filterMenusByPermissions(
(menu as SubMenuType).children as CustomMenuItemType[]
);
Expand All @@ -44,9 +44,9 @@

const selectMenu = useCallback(
(config: MenuProps['items'] = [], pathname: string): string[] => {
for (const route of config) {
if (!route) {
return [];
continue;

Check warning on line 49 in packages/base/src/page/Nav/SideMenu/MenuList/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 49 in packages/base/src/page/Nav/SideMenu/MenuList/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
}

Check warning on line 50 in packages/base/src/page/Nav/SideMenu/MenuList/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
const realPath = `/${route?.key}`.replace(
SIDE_MENU_DATA_PLACEHOLDER_KEY,
Expand Down
Loading