Skip to content

Conversation

poteto
Copy link
Member

@poteto poteto commented Sep 18, 2025

Previously, createFileMap split the MDX meta string on spaces and assumed the first token was the filename. Once we prefixed code fences with {expectedErrors: ...}, it would incorrectly parse the meta and crash.

This PR updates createFileMap to skip tokens in the meta containing a start and end brace pair (using a stack to ensure we close on the correct brace) while tokenizing the meta string as expected.

Test plan: pages reported in #7994 no longer crash on the next PR

Closes #7994


Stack created with Sapling. Best reviewed with ReviewStack.

Copy link

github-actions bot commented Sep 18, 2025

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 128.02 KB (🟡 +194 B) 238.56 KB
/500 128.03 KB (🟡 +194 B) 238.57 KB
/[[...markdownPath]] 130.12 KB (🟡 +194 B) 240.66 KB
/errors 128.27 KB (🟡 +194 B) 238.81 KB
/errors/[errorCode] 128.25 KB (🟡 +194 B) 238.79 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Previously, `createFileMap` split the MDX meta string on spaces and assumed the first token was the filename. Once we prefixed code fences with `{expectedErrors: ...}`, it would incorrectly parse the meta and crash.

This PR updates createFileMap to skip tokens in the meta containing a start and end brace pair (using a stack to ensure we close on the correct brace) while tokenizing the meta string as expected.

Test plan: pages reported in #7994 no longer crash on the next PR

Closes #7994
@poteto
Copy link
Member Author

poteto commented Sep 18, 2025

Note: lint failures from lint-markdown-code-blocks are expected (next PR fixes them)

@poteto poteto merged commit f369f3e into main Sep 18, 2025
8 of 10 checks passed
@poteto poteto deleted the pr7996 branch September 18, 2025 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: "Application error: a client-side exception has occurred" on docs pages

1 participant