-
-
Notifications
You must be signed in to change notification settings - Fork 199
fix: render empty nav items correctly not link #2929
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for rspress-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where navigation items with empty children arrays were incorrectly rendered as links instead of being handled as parent menu items. The fix removes the length check when determining whether an item should be treated as a menu with children, allowing the downstream NavMenuItemWithChildren component (which already handles empty arrays at lines 47-60) to properly render these items.
Key Changes:
- Removed the
item.items.length > 0check from the condition inNavMenuItem, now only checking ifitemsproperty exists and is an array - This ensures items with empty children arrays are passed to
NavMenuItemWithChildreninstead of being incorrectly cast toNavItemWithLink
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4c9bb62 to
ef93163
Compare
ef93163 to
ad5bbb6
Compare
|
遇到了什么问题吗,预期是 |
现在
这里其实
|
cc7d72a to
b0c2cc6
Compare
b0c2cc6 to
2991dc5
Compare
Summary
render empty nav items correctly not link, empty items should already be handlered at
rspress/packages/core/src/theme/components/Nav/NavMenu.tsx
Lines 47 to 60 in b93fade
Related Issue
N/A
Checklist