-
Notifications
You must be signed in to change notification settings - Fork 2
fix: exclude index pages correctly #23
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
Conversation
|
WalkthroughThe update introduces a helper function to centralize route inclusion and exclusion logic for sidebar items, modifies how index pages are filtered, and updates configuration to refine which routes are included. Additionally, a changeset metadata file documents a patch fix for excluding index pages. No public API changes were made. Changes
Sequence Diagram(s)sequenceDiagram
participant Config
participant Sidebar
participant isExcluded
Config->>Sidebar: Provide onlyIncludeRoutes and excludeRoutes
Sidebar->>isExcluded: Check if sidebar item (including index) should be excluded
isExcluded-->>Sidebar: Return exclusion result
Sidebar->>Sidebar: Filter items based on isExcluded
Sidebar-->>Config: Return filtered sidebar
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🔇 Additional comments (5)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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 refactors route inclusion/exclusion in the auto-sidebar plugin and updates the sample config.
- Extract common exclude logic into an
isExcludedhelper - Apply the new helper in
processSideMetaand top-levelwalkto correctly skip index pages - Add a new development route to
onlyIncludeRoutesin the sample YAML
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/plugins/auto-sidebar/walk.ts | Introduce isExcluded, use it for both nested sidebars and index |
| fixture-docs/doom.config.yml | Add '*/development/component-quickstart/*' to onlyIncludeRoutes |
Comments suppressed due to low confidence (3)
src/plugins/auto-sidebar/walk.ts:46
- [nitpick] The helper name
isExcludedis ambiguous; consider renaming toshouldExcludeRouteorisRouteExcludedfor clarity.
const isExcluded = (
fixture-docs/doom.config.yml:45
- The double hyphen creates a nested list of lists;
onlyIncludeRoutesexpects a flat array of strings. Change to- '*/install/**'.
- - '*/install/**'
src/plugins/auto-sidebar/walk.ts:366
- Optional chaining with double negation may be parsed incorrectly; wrap the check in parentheses or split into two conditions, e.g.
const hasKey = !!(index?._fileKey); const isIndexExcluded = hasKey && isExcluded(...).
!!index?._fileKey &&
commit: |
Signed-off-by: JounQin <admin@1stg.me>
| const isIndexExcluded = | ||
| !!index?._fileKey && | ||
| isExcluded(onlyIncludeRoutes, excludeRoutes, index._fileKey) | ||
|
|
||
| const sidebars = index && !isIndexExcluded ? [index, ...others] : others |
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.
| const isIndexExcluded = | |
| !!index?._fileKey && | |
| isExcluded(onlyIncludeRoutes, excludeRoutes, index._fileKey) | |
| const sidebars = index && !isIndexExcluded ? [index, ...others] : others | |
| const sidebars = index?._fileKey &&! isExcluded(onlyIncludeRoutes, excludeRoutes, index._fileKey) ? [index, ...others] : others |
Summary by CodeRabbit
Bug Fixes
Chores