-
Notifications
You must be signed in to change notification settings - Fork 4k
Remove hidden site spaces from navigation #3795
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
🦋 Changeset detectedLatest commit: 3f3eedf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Summary of the deployments:
Test content
|
Introduces filtering of hidden site spaces when parsing site context, sections, and groups. Ensures only visible site spaces are included unless they match the current site space ID, improving context accuracy for site structure handling.
efadc96 to
3f3eedf
Compare
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 introduces filtering to remove hidden site spaces from navigation structures while preserving the current site space even if it's hidden. This ensures only visible site spaces are shown in the navigation while maintaining context accuracy for the active space.
Key changes:
- Added
filterHiddenSiteSpacesandfilterHiddenSiteSpacesFromSectionsutility functions to filter hidden spaces - Modified
parseSiteSectionsAndGroupsto apply filtering recursively across sections and groups - Updated
fetchSiteContextByIdsto filter hidden spaces for bothsiteSpacesandsectionsstructure types
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/gitbook/src/lib/context.ts | Adds filtering functions and applies them to site context parsing to exclude hidden site spaces from navigation |
| .changeset/three-melons-enjoy.md | Documents the patch-level change for removing hidden site spaces from navigation |
Comments suppressed due to low confidence (1)
packages/gitbook/src/lib/context.ts:422
- The
checkIsRootSiteContextfunction uses unfiltered sections fromgetSiteStructureSections, which may include hidden site spaces. This creates inconsistency with the filteredcontext.sectionsdata. The function should either use the already-filtered sections from the context or apply the same filtering logic to ensure consistency.
return getSiteStructureSections(structure, { ignoreGroups: true }).some(
(structure) =>
structure.default &&
structure.id === context.sections?.current.id &&
structure.siteSpaces.some(
(siteSpace) => siteSpace.default && siteSpace.id === context.siteSpace.id
)
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Introduces filtering of hidden site spaces when parsing site context, sections, and groups. Ensures only visible site spaces are included unless they match the current site space ID, improving context accuracy for site structure handling.