Skip to content

Commit 9e878ae

Browse files
authored
fix(docs): backport #22617 — label-based API version mapping (v4-next) (#22622)
Backport of #22617 — *fix(docs): restore Aztec.nr API reference links on v4.2.0* — to `v4-next` via `backport-to-v4-next-staging`. ## Why the automatic cherry-pick failed The upstream fix modifies `docs/developer_versioned_docs/version-v4.2.0/docs/aztec-nr/api.mdx`, which does **not exist on v4-next**. Git's rename detection landed the diff on `version-v4.1.0-rc.2/docs/aztec-nr/api.mdx` with conflict markers — the wrong target. On v4-next, the equivalent stale `useApiVersion` logic lives in `docs/docs-developers/docs/aztec-nr/api.mdx`. That file is the source from which future versioned snapshots are cut, so without this fix the same regression would recur the moment v4.2.0 developer docs are cut from v4-next. ## Commit structure Per `CLAUDE.md` backport guidance: 1. `cherry-pick: ... (with conflicts)` — mechanical cherry-pick committed AS-IS for history. 2. `fix: resolve cherry-pick conflicts by reverting wrong target` — restores `version-v4.1.0-rc.2/...` (whose existing name-based logic already resolves correctly for its `Testnet (v4.1.0-rc.2)` label, since the name matches `includes("rc")`). 3. `fix(docs): use label-based API version mapping in docs-developers aztec-nr api page` — applies the same 7/-5 change from #22617 to the real v4-next target. ## Net diff ``` docs/docs-developers/docs/aztec-nr/api.mdx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) ``` Full analysis: https://gist.github.com/AztecBot/4994eafc80a7cc7081ecf215fc4a9aec ## Test plan - [ ] `yarn start` locally on v4-next, open the Aztec.nr API Reference under the Alpha version, confirm links resolve. - [ ] Verify the next v4.2.0 versioned cut from v4-next inherits the fixed logic. ClaudeBox log: https://claudebox.work/s/056d3a595d4c0d37?run=1
2 parents bb75dd9 + 23cde9a commit 9e878ae

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • docs/docs-developers/docs/aztec-nr

docs/docs-developers/docs/aztec-nr/api.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ import { useActiveVersion } from "@docusaurus/plugin-content-docs/client";
1010

1111
export const useApiVersion = () => {
1212
const version = useActiveVersion("developer");
13-
const versionName = version?.name || "current";
14-
// Map Docusaurus version to API docs folder
15-
if (versionName === "current") return "next";
16-
if (versionName.includes("rc") || versionName.includes("testnet")) return "testnet";
17-
return versionName;
13+
if (!version || version.name === "current") return "next";
14+
// Map Docusaurus version to API docs folder using version label
15+
// Labels are set explicitly in docusaurus.config.js (e.g., "Mainnet (...)")
16+
const label = version.label || "";
17+
if (label.startsWith("Alpha")) return "mainnet";
18+
if (label.startsWith("Testnet")) return "testnet";
19+
return version.name;
1820
};
1921

2022
export const ModuleLink = ({ path, children }) => {

0 commit comments

Comments
 (0)