Repository navigation
fix(portal): drop the code block guard Fumadocs 12.1 makes unnecessary - #417
Conversation
fumadocs-openapi 12.1 skips a response example that has no `value` (fuma-nama/fumadocs#3608), so `undefined` no longer reaches the code block and the operation page no longer crashes. The template's own CodeBlock, which only existed to skip that case (#373), is removed and pages render through Fumadocs' default code block. The usage tabs take the code block from useComponents(), and the cURL tab renders nothing itself when no example request is available, which the removed guard used to cover. Refs #370 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
QA test casesWhat to verify: an API reference page renders when an OpenAPI example has no This PR also swaps the portal's own code block for Fumadocs' default one, so cases 5–8 check that cURL, SDK samples and response JSON still look and behave the same. Build under test: branch Setup (about 5 minutes)
|
| # | Case | Steps | Expected result |
|---|---|---|---|
| 1 | Response example with no value doesn't crash the page |
Open API Reference → Items → List Items. | The page renders fully. No "Something went wrong", and no console error mentioning <Placeholder> or reading 'split'. |
| 2 | The value-less example is left out | On List Items, look at the 200 response example. | It shows only { "id": "1" }. There's no blank or empty Default entry, and no accordion because only one example is left. |
| 3 | Response whose only example has no value |
Open Create Item and look at the 201 response example. | The page renders, and the 201 tab shows Empty. |
| 4 | Request example with no value |
On Create Item, open the example dropdown above the code tabs. Pick Filled request, then Empty. | Both are listed, and switching never crashes the page. Filled request gives a cURL whose -d body has "id": "2". Empty gives -d '{}'. |
| 5 | Code blocks are still highlighted | On List Items and Create Item, check the cURL tab, the TypeScript SDK sample tab and the response JSON. Toggle light/dark theme. | Each block is syntax-highlighted in both themes, and its Copy button copies the exact text. They look the same as on dev before this PR. |
| 6 | cURL follows the server and playground edits | On List Items, switch the server to Sandbox, then change limit to 5 in the playground. |
The cURL URL changes to https://sandbox.repro.test/items?limit=10, then to …?limit=5. |
| 7 | Control operation is unaffected | Switch the server back to Production (the portal remembers the server picked in case 6), then open Get Item. | cURL shows https://api.repro.test/items/1, and the 200 response shows { "id": "1", "name": "Widget" }. |
| 8 | Direct load and reload | Paste the List Items URL into a new tab, then hard-reload (Ctrl+Shift+R). | The page renders the same as in case 1 both times, with no crash. |
| 9 | Generated static site | Stop serve, run pnpm apimatic portal generate -i <path-to>/qa-370 --destination <path-to>/qa-370-site, serve that folder with npx serve <path-to>/qa-370-site, and open List Items and Create Item. |
generate succeeds, and both pages behave as in cases 1–4. |
Pass criteria and reporting
The PR passes when all 9 cases pass and the console shows no new errors on any operation page.
For a failure, report the case number, the browser and version, a screenshot of the page, and the console output.
|
🎉 This PR is included in version 2.0.0-beta.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |



fumadocs-openapi12.1 now skips a response example that has novalue(fuma-nama/fumadocs#3608), so an operation page no longer crashes withCannot read properties of undefined (reading 'split'). This removes the template's ownCodeBlock, which only existed to guard that case (#373), and lets pages render through Fumadocs' default code block.code-block.tsxis deleted, andapi-page.tsxno longer passescomponents: { CodeBlock }.useComponents(). The cURL tab renders nothing itself when no example request is available, which the removed guard used to cover.Verified with the spec from #370, plus a value-less request example and a response whose only example has no value, on 12.1.1: both operation pages render in the browser, the empty example is left out of the response, and a response with only an empty example shows "Empty". Tests, lint and the e2e portal build pass.
Refs #370
🤖 Generated with Claude Code