Skip to content

Conversation

@Actyler
Copy link

@Actyler Actyler commented Dec 1, 2025

Description

本次更改是利用AI完成,对源码不熟,不能保证最少得代码修改
bug复现如下
需要配合修改playground/src/router/routes/modules/demos.ts 147行

  • 当给HideChildrenInMenuParentDemo增加component,同时两个子菜单增加了meta.hideInMenu=true时,页面的跳转会有问题
  • 当给HideChildrenInMenuParentDemo增加component,去除子菜单的meta.hideInMenu=true,仍然有同样的问题
  • demos.ts修改如下
    { name: 'HideChildrenInMenuParentDemo', path: '/demos/features/hide-menu-children', meta: { icon: 'ic:round-menu', title: $t('demos.features.hideChildrenInMenu'), }, component: () => import('#/views/demos/features/hide-menu-children/parent.vue'), children: [ { name: 'HideChildrenInMenuDemo', path: '/demos/features/hide-menu-children/parent', component: () => import( '#/views/demos/features/hide-menu-children/parent.vue' ), meta: { hideInMenu: true, title: $t('demos.features.hideChildrenInMenu'), }, }, { name: 'HideChildrenInMenuChildrenDemo', path: '/demos/features/hide-menu-children/children', component: () => import( '#/views/demos/features/hide-menu-children/children.vue' ), meta: { hideInMenu: true, activePath: '/demos/features/hide-menu-children', title: $t('demos.features.hideChildrenInMenu'), }, }, ], },
image

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • Run the tests with pnpm test.
  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of hidden navigation routes, ensuring proper navigation context is preserved when accessing nested routes.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Dec 1, 2025

⚠️ No Changeset found

Latest commit: a872e82

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

A new helper function flattenHiddenChildren() recursively flattens routes, promoting hidden child routes to top-level while preserving navigation context via activePath metadata. The route generation heuristic is updated to check if all children are hidden, and flattened routes replace direct usage in the augmentation flow.

Changes

Cohort / File(s) Summary
Route flattening and hidden children handling
packages/effects/access/src/accessible.ts
Introduces flattenHiddenChildren() helper to recursively flatten routes and promote hidden children to top-level with activePath metadata. Updates route generation heuristic to check meta.hideInMenu for all children before collapsing routes. Replaces accessibleRoutes with flattenedRoutes in dynamic route augmentation flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • The flattenHiddenChildren() recursive logic needs careful verification for edge cases and termination conditions
  • The updated route collapsing heuristic (checking if all children are hidden) may impact existing route structures—verify no unintended side effects
  • Ensure activePath metadata is correctly propagated and used by downstream route processing/navigation logic

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • mynetfan
  • anncwb
  • jinmao88
  • vince292007

Poem

🐰 Hidden children, now unbound and free,
Flattened from their nested tree!
With activePath to guide the way,
Routes bloom brighter every day! 🌱

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ⚠️ Warning The PR description is incomplete and does not follow the required template structure. Critical sections are missing or inadequately filled. Complete the description section with clear explanation in English, ensure all checklist items are properly verified and marked, and provide detailed context about the bug fix and its solution.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title references a bug fix for hidden child menu navigation issues, which aligns with the code changes that flatten hidden child routes and fix navigation problems.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant