Skip to content

Conversation

@nolannbiron
Copy link
Member

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.

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2025

🦋 Changeset detected

Latest commit: 3f3eedf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
gitbook Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

Summary of the deployments:

Version URL Status
Vercel
Cloudflare

Test content

Site 2v 2c
GitBook /url/gitbook.com/docs /url/gitbook.com/docs
E2E /url/gitbook.gitbook.io/test-gitbook-open /url/gitbook.gitbook.io/test-gitbook-open

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.
Copy link
Contributor

Copilot AI left a 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 filterHiddenSiteSpaces and filterHiddenSiteSpacesFromSections utility functions to filter hidden spaces
  • Modified parseSiteSectionsAndGroups to apply filtering recursively across sections and groups
  • Updated fetchSiteContextByIds to filter hidden spaces for both siteSpaces and sections structure 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 checkIsRootSiteContext function uses unfiltered sections from getSiteStructureSections, which may include hidden site spaces. This creates inconsistency with the filtered context.sections data. 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.

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.

2 participants