Skip to content

Conversation

@mhartington
Copy link
Contributor

@mhartington mhartington commented Nov 20, 2025

This adds a custom prop support to our Subsection component. With this we can exclude specific pages from being rendered in our sub-sections, but still use them if we need custom redirects

Summary by CodeRabbit

  • New Features
    • Documentation sections can be configured to be hidden from subsection listings for cleaner navigation.
  • Bug Fixes / UX
    • Related/section lists now omit the current page to avoid self-references, improving relevance of suggestions.

✏️ Tip: You can customize this high-level summary in your review settings.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

Dangerous URL check

No absolute URLs to prisma.io/docs found.
No local URLs found.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

Walkthrough

A documentation category JSON adds customProps.hide_from_subsection: true, and the DocCardList component now uses a functional state updater to filter out current-path items and those with customProps.hide_from_subsection.

Changes

Cohort / File(s) Summary
Configuration Update
content/200-orm/500-reference/300-errors/_category_.json
Adds a trailing comma and a customProps object with hide_from_subsection: true to control subsection visibility.
Component Filtering Logic
src/theme/DocCardList/index.tsx
Switches state setter to a functional updater and applies two filters: remove items whose href ends with the current pathname, and remove items with customProps.hide_from_subsection truthy.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check the functional updater prevents stale-closure issues.
  • Verify pathname matching logic (href endsWith pathname) doesn't over-filter.
  • Confirm optional chaining or existence checks for customProps.hide_from_subsection handle missing props safely.

Possibly related PRs

  • fix: clean-up from prisma 7 #7287 — Modifies src/theme/DocCardList/index.tsx and related config to hide certain items from lists; uses a className-based approach that overlaps with this change.

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(): exclude custom subsections' accurately reflects the main change: adding functionality to exclude specific pages from subsections via a custom prop.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cce4959 and 7368e84.

📒 Files selected for processing (2)
  • content/200-orm/500-reference/300-errors/_category_.json (1 hunks)
  • src/theme/DocCardList/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/theme/DocCardList/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Check internal links
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
content/200-orm/500-reference/300-errors/_category_.json (1)

1-5: JSON structure is valid; implementation aligns with PR objectives.

The configuration correctly introduces the hide_from_subsection custom property as intended. JSON syntax is sound: the className property has a trailing comma (line 2), customProps is the final property (line 4), and the object closes cleanly.

To ensure this change works end-to-end, please verify that the complementary DocCardList component in src/theme/DocCardList/index.tsx correctly checks for customProps.hide_from_subsection when filtering items. The AI summary indicates it now applies two filters—one for path matching and one for this new flag—but I want to confirm the implementation handles the case where customProps or hide_from_subsection may not be present on all items.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

No files changed.

@github-actions
Copy link
Contributor

Redirect check

This PR probably requires the following redirects to be added to static/_redirects:

  • This PR does not change any pages in a way that would require a redirect.

@github-actions
Copy link
Contributor

🍈 Lychee Link Check Report

Note: Links are cached for 5 minutes. Failed links (timeouts, rate limits) are retried in a second run with longer timeout.

📊 Results Overview

Status Count
🔍 Total 2224
✅ Successful 2195
⏳ Timeouts 0
🔀 Redirected 4
👻 Excluded 23
❓ Unknown 0
🚫 Errors 1
⛔ Unsupported 1

Errors per input

Errors in 800-guides/320-permit-io-access-control.mdx

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 20, 2025

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7368e84
Status: ✅  Deploy successful!
Preview URL: https://78431117.docs-51g.pages.dev
Branch Preview URL: https://docs-ui-fix.docs-51g.pages.dev

View logs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/theme/DocCardList/index.tsx (1)

22-26: Recompute filtered items from items instead of re‑filtering previous state

Right now the effect ignores the latest items value and only refines prevFilteredItems. If items ever changes (e.g., sidebar structure updates), new entries will never appear in filteredItems, and repeated runs just keep filtering an already filtered list.

Since this is purely derived state, it’s safer and simpler to base the effect on items directly:

-  useEffect(() => {
-    setFilteredItems(prevFilteredItems => 
-      prevFilteredItems
-        .filter((e: any) => e?.href?.slice(0, -1) !== location.pathname)
-        .filter((e: any) => !e?.customProps?.hide_from_subsection)
-    );
-  }, [items]);
+  useEffect(() => {
+    setFilteredItems(
+      filterDocCardListItems(items)
+        .filter((e: any) => e?.href?.slice(0, -1) !== location.pathname)
+        .filter((e: any) => !e?.customProps?.hide_from_subsection),
+    );
+  }, [items]);

This keeps the new hide_from_subsection behavior while avoiding stale or out‑of‑sync lists.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c9414d and cce4959.

📒 Files selected for processing (2)
  • content/200-orm/500-reference/300-errors/_category_.json (1 hunks)
  • src/theme/DocCardList/index.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Check internal links
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
content/200-orm/500-reference/300-errors/_category_.json (1)

2-4: Custom props wiring looks consistent and JSON is valid

customProps.hide_from_subsection is named consistently with the consumer in DocCardList, and the JSON remains syntactically valid with the additional property. No further changes needed here.

@github-actions
Copy link
Contributor

No files changed.

@mhartington mhartington merged commit 8526167 into main Nov 20, 2025
8 checks passed
@mhartington mhartington deleted the docs-ui-fix branch November 20, 2025 17:18
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.

3 participants