fix: sidebar collapses to first section folder on single-content-dir sites - #162
fix: sidebar collapses to first section folder on single-content-dir sites#162ravisuhag wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedNext included review available in 50 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe SSR fetch path now filters the page tree by version, compacts it directly, and leaves content-directory scoping to other code instead of applying it in ChangesSSR documentation tree scoping
Estimated code review effort: 2 (Simple) | ~5 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
…sites entry-server pre-scoped the page tree to the active content dir before embedding it, but DocsLayout applies filterPageTreeByContentDir again during both SSR and client rendering. On sites with a single content entry the second pass matched the first section folder (all its URLs are under the content prefix) and unwrapped it, so the sidebar showed only that folder's children and dropped every other page. Embed the version-filtered tree instead and leave content-dir scoping to DocsLayout, which is the single place that does it for SSR and client alike. Verified against raystack/meteor docs (35-extractor sidebar): before, the sidebar rendered only the 7 Concepts pages; after, all 73 pages render in their sections.
b923de4 to
528e9ca
Compare
Problem
On any site with a single
content:entry, the sidebar renders only the children of the first section folder — every other page and section disappears.Cause
Double application of
filterPageTreeByContentDir:entry-server.tsxscopes the tree to the active content dir before embedding it in__PAGE_DATA__(unwraps the content-root folder).DocsLayoutappliesfilterPageTreeByContentDiragain — during both SSR and client rendering.The function finds the first folder whose URLs are all under
/<contentDir>. On an already-scoped tree that's the first section folder (e.g. Concepts), so the tree collapses to its children.Fix
Embed the version-filtered tree and let
DocsLayoutremain the single scoping point.compactTreestrips therootmarker anyway, so the client could never detect an already-scoped tree.Verification
Built raystack/meteor docs against the patched source: before, the sidebar showed only the 7 Concepts pages; after, all 73 pages render under Concepts / Guides / Extractors (36) / Processors / Sinks / Reference / Contribute. Checked via browser DOM, both SSR and hydrated.