fix: Include Render partial headings in page TOC#32267
Open
mvvmm wants to merge 3 commits into
Open
Conversation
Contributor
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
Contributor
|
Preview URL: https://6e56e561.preview.developers.cloudflare.com |
mvvmm
marked this pull request as ready for review
July 23, 2026 05:19
Contributor
Review
👉 Fix in your agent 👈Fix the following review findings in PR #32267 (https://github.com/cloudflare/cloudflare-docs/pull/32267).
Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order
After triaging, follow this order:
1. Post a comment on this PR for any findings you are skipping, with the finding ID and your reasoning.
2. Then commit the fixes for the legitimate findings.
The comment must come before the commit — the bot reads PR comments when a new
push triggers a review, so skip comments posted after the push will be missed.
---
## Code Review
### Warnings (3)
#### CR-87f9094495f5 · Stale global cache in dev
- **File:** `src/util/rendered-toc.ts` line 59
- **Issue:** dynamicPartials is computed once and cached for the module lifetime; edits to partials that add or remove AnchorHeading will not be reflected until the dev server restarts.
- **Fix:** Add an invalidation hook tied to the content layer, or recompute the dynamic partials set when partial collection versions change during dev.
#### CR-9b55932ee252 · Swallowed runtime-heading scrape failure
- **File:** `src/pages/[...slug].astro` line 89
- **Issue:** If `scrapeRenderedHeadings` throws, the `catch` logs to stderr but falls back to the compile-time `headings` array, so the runtime headings the PR is adding will be silently omitted for that page.
- **Fix:** Surface extraction failures explicitly (e.g., rethrow or fail the build) instead of silently falling back, or at least emit a clear build-level warning so missing headings are not masked.
#### CR-5e9ed82e2260 · Redundant dependency override
- **File:** `package.json` line 164
- **Issue:** The `@cloudflare/nimbus-docs` devDependency is pinned to `0.7.1` and a `pnpm.overrides` entry also forces the same package to the `0.7.1` tarball URL. If the dependency version is bumped later without updating the override, pnpm will silently continue installing the old tarball.
- **Fix:** Remove the `pnpm.overrides` entry if the direct dependency pin is sufficient, or add a comment explaining why the override is required for transitive resolution.
### Suggestions (3)
#### CR-5f74a8ee6f18 · Redundant minimumReleaseAgeExclude entry
- **File:** `pnpm-workspace.yaml` line 27
- **Issue:** The newly added `overrides` entry resolves `@cloudflare/nimbus-docs` from a pinned tarball URL, bypassing registry age checks entirely. This makes the earlier `minimumReleaseAgeExclude: @cloudflare/nimbus-docs` entry (whose comment says it exempts freshly-cut registry versions from the 24h wait) redundant and its justification inconsistent with the override.
- **Fix:** Remove `@cloudflare/nimbus-docs` from `minimumReleaseAgeExclude` since the tarball override already sidesteps registry age checks, or document why both settings are needed if there is another reason.
#### CR-6c5665c1f111 · Regex-based Render detection is fragile
- **File:** `src/util/rendered-toc.ts` line 21
- **Issue:** body.matchAll(/<Render\b[^>]*>/g) matches literal <Render> tags anywhere in the raw MDX source, including code blocks and documentation examples.
- **Fix:** Use MDX AST parsing to locate actual Render component usages instead of regex-matching raw source.
#### CR-57e8bf6bface · Whole-page double render
- **File:** `src/pages/[...slug].astro` line 88
- **Issue:** When runtime headings are detected, the entire `Content` component is rendered again in an `AstroContainer` only to collect headings, adding build overhead for every affected page.
- **Fix:** Consider caching the container render or extracting headings directly from partial HTML to avoid rendering the full page twice.
Code ReviewThis code review is in beta and may not always be helpful — use your judgment. Warnings (3)
Suggestions (3)
ConventionsNo convention issues found. Style Guide ReviewNo style-guide issues found. CommandsOnly codeowners can run commands. Post a comment with the command to trigger it.
|
mvvmm
marked this pull request as draft
July 23, 2026 05:19
MohamedH1998
marked this pull request as ready for review
July 23, 2026 11:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consumes the pkg.pr.new Nimbus build from cloudflare/nimbus#36, which adds
partialHeadingssupport togetDocsPageProps.Adds the cloudflare-docs-specific
resolvePartialIdresolver tosrc/pages/[...slug].astro, matchingRender.astro'sproduct ? \${product}/${file}` : fileconvention. This lets Nimbus collect markdown headings from the same partials that render in-page via`.Fixes literal markdown headings inside rendered partials missing from the page TOC. For example,
/bots/plans/pro/now includes "Bot settings versus custom rules" (frompartials/bots/bot-settings-vs-custom-rules.mdx) in its on-this-page TOC.Does not fix
AnchorHeading-generated headings; those are runtime component output and need a separate cloudflare-docs-specific follow-up if desired.Documentation checklist