docs(website): Framework selector switches between equivalent pages - #4202
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Pages can name their counterpart in the other framework with `framework_equivalent:` front matter when it has a different doc id, so the selector moves between React's DataProvider and Vue's DataClientPlugin instead of disabling the other framework. framework-docs/index.js `docsFor()` now lists each framework's docs with their routes (honoring `slug`), shared by remarkFramework's link rewriting, docsToMarkdown's routeOf and the selector's equivalents. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fjs86eqj7vj4ia4om1Cmbo
Also simplifies after review: frameworkEquivalents() emits both directions so the selector does one lookup, and routes come from Docusaurus' own getSlug() instead of a hand-rolled copy of its rules. Vue skill references now link Vue's composables testing guide at its slugged route, so their Vue variants regenerate. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fjs86eqj7vj4ia4om1Cmbo
74e3d1c to
347f4ff
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Staff engineer (Cursor agent): LGTM at 347f4ff. No changes requested for this PR. The direction is right: Optional follow-ups after merge (none of these should block this PR):
Bugbot, |
- frameworkEquivalents() only records a reverse pair when it can be used, and fails the build when two pages would claim it - schema.md says Vue/renderDataCompose() in Vue renders, so the Vue skill reference no longer tells Vue users to use renderDataHook() Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fjs86eqj7vj4ia4om1Cmbo
|
Staff follow-ups, all handled in this PR (d52f803):
Website build: no warnings. Generated by Claude Code |
unit-testing-hooks.vue.md only shared React's doc id (plus a slug) so the framework selector could find it. With framework_equivalent it can be a real Vue page: unit-testing-composables.vue.md, same URL. A page that names its own framework_equivalent now keeps it instead of taking a reverse pair from another page. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fjs86eqj7vj4ia4om1Cmbo
Requested by Nathaniel · project thread
Before: on
<DataProvider />the framework selector's Vue option was disabled ("This page is not available for Vue"), and on Vue's DataClientPlugin React was disabled, though they document the same thing. Same forrenderDataHook()/makeRenderDataHook()vs Vue's composables testing guide.After: picking the other framework moves between those pages. A page names its counterpart once, on either side:
The build fails if the named doc doesn't exist in the other framework. The URL hash only carries over when switching to the same doc.
Pairs wired:
api/DataProviderapi/DataClientPluginapi/renderDataHook,api/makeRenderDataHookguides/unit-testing-hooks(/vue/guides/unit-testing-composables)Audit: these are the only React-only pages with a Vue page covering the same thing. Boundaries (
AsyncBoundary,ErrorBoundary) have only an example inside error-policy on the Vue side, so they stay disabled.How
website/framework-docs/index.jsdocsFor(framework)lists each framework's docs with their route (from Docusaurus' owngetSlug(), soslugand category indexes match the site) andframework_equivalent.frameworkEquivalents()emits the pairs in both directions intositeConfig.customFields, whichFrameworkSelectorreads.remarkFrameworkrewriteLinksanddocsToMarkdownrouteOf(Staff note from docs: Generate DevTools MCP and Vue testing skill references from docs #4181): absolute/docs/<id>links rendered for Vue now go to the Vue page's real route instead of ignoringslug. No site page hits this today (docs/core links to the guide relatively, which Docusaurus already resolves), but the Vue skill references did:docs/rest/api/schema.mdlinks/docs/guides/unit-testing-hooks, which now renders as/vue/guides/unit-testing-composablesfor Vue, soschema.vue.mdvariants are now generated indata-client-restanddata-client-schema.Verified: website typecheck and build pass with no warnings;
yarn build:skills --checkclean; Playwright on the built site (desktop and iPhone touch) switches both pairs in each direction and keeps#exampleon useSuspense.No changeset: website and docs only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Fjs86eqj7vj4ia4om1Cmbo
Note
Low Risk
Documentation and website build tooling only; no runtime library or application behavior changes.
Overview
Adds
framework_equivalentfront matter so the docs framework selector can jump between React and Vue pages that cover the same topic but use different doc ids (e.g.DataProvider↔DataClientPlugin, hook testing ↔ composables testing). The build validates counterparts and exposes bidirectional maps viacustomFields.frameworkEquivalentsforFrameworkSelector, which now navigates to the equivalent page and only preserves the URL hash when staying on the same doc id.Replaces
docIdswithdocsFor(), which records each page’s real route (DocusaurusgetSlug, including customslug).remarkFrameworkanddocsToMarkdownuse that map so absolute/docs/...links and skill exports resolve to the correct Vue paths (e.g. unit-testing composables).Docs and skills follow: dedicated Vue composables testing guide and sidebar entry, cross-framework links in
schema.md, regeneratedschema.vue.mdskill references with fixed internal links, and widespreadschema.md→schema.vue.mdlink updates in agent skill files.Reviewed by Cursor Bugbot for commit afef320. Bugbot is set up for automated code reviews on this repo. Configure here.