Repository navigation
fix(portal): catch unknown components and invalid MDX in content pages before readers see them - #444
Open
mehnoorsiddiqui wants to merge 1 commit into
Open
mehnoorsiddiqui wants to merge 1 commit into
mehnoorsiddiqui wants to merge 1 commit into
Conversation
…s before readers see them A page naming a component the portal does not provide, or a page that is not valid MDX, is now refused by `portal generate` and `portal serve`, at startup and on save, with every broken page listed by its line and column. A page that still fails to render while it is prerendered fails the build, quoting the server's error. Closes #442 Closes #443 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mehnoorsiddiqui
requested review from
Shield-Jaguar and
saeedjamshaid
as code owners
October 19, 2026 12:26
|
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.



Closes #442
Closes #443
The problem
Two kinds of mistake in an
.mdxcontent page reached readers instead of the author:<Banner>, or a typo like<Accordian>). MDX compiles the page anyway and only looks the component up when the page renders.portal generatereported success and shipped a blank page, andportal serveshowed "Something went wrong!" in the browser with nothing in the terminal (portal: a page using an unsupported or misspelled MDX component builds as 'Succeeded' but shows 'Something went wrong!' to readers #442).<Cards>, a mismatched closing tag, a broken{…}expression).portal servestarted without a word and the browser showed "Failed to fetch dynamically imported module".portal generatefailed, but reported only the first broken page, under a temporary path, with bundler internals such as[plugin fumadocs-mdx:mdx],?macro_id=…anderrors: [Getter/Setter](portal: MDX syntax errors (e.g. missing </Cards>) are not reported by 'portal serve', and 'portal generate' reports only the first one #443).What changes
The content check now refuses both. The CLI already parses every page the way the build does, so it now reports what it finds.
portal generateandportal serverun this check at startup, andserveruns it again on every save incontent/. On a refused save, the preview keeps the last version it accepted.<Tip>is not taken for<Step>.Note,Tip,Info,Warningand the other admonitions →CalloutCardGroup→CardsAccordionGroup→AccordionsCodeGroup→TabsTabItem→Tabsrc. MDX's own wording is kept, without the parser's internals:{…}expression. When a prerendered page holds React's marker for a part that threw on the server, the build now fails and quotes the error the server reported. That error used to fall outside the log lines the CLI shows.mdx-components.test.tsreadsportal-template/src/components/mdx.tsxand checks that it matches the CLI's list.Not covered
<Cards>reports one of them, and the next appears once that one is fixed. The message says so. Listing every unclosed tag would need a tag-matching pass of our own, outside MDX, and could disagree with it.servedoesn't start over broken content. It reports the problem and exits, as it already does for other content problems. Once it is running, a broken save is reported and the last good version stays in the preview.react-domleaves 19.2, so the markers get checked again on upgrade. The check watches the build'sconsole.errorfor TanStack's render-error reports, because TanStack logs those errors nowhere else. It installs this only forvite build.How it was tested
APIMATIC_E2E=1 npm test: 1967 passing, ESLint clean.failed-render: a component inside an expression.failed-render-late: a component that suspends and then throws.portal generaterun by hand on a copy of the default fixture with broken pages. The output is shown above.remark-mdx3.1.1 and micromark extensions that@mdx-js/mdx3.1.1 uses in the build, so both find the same syntax errors.🤖 Generated with Claude Code