-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug with (injected) custom elements and layouts
This fixes a bug, uncovered in #2112 and in #2123, which is rather unlikely to occur. It only occurs when: 1. Custom elements (such as `<a-b></a-b>`) are injected (not authored) into a tree 2. Either: 1. A layout component is defined within an MDX document 2. A provider is used, and any component is defined within MDX documents In those cases, an accidental `const ;` was injected into the final serialized document. Which caused anything trying to run the code to crash. The problem was introduced in 9904838, the commit message of which sheds some light on why custom elements are peculiar and need extra handling. We track which component contains which other components. If some component uses `<A />`, then some code to handle `A` is injected in that component. If a different component uses `<B />`, some code for `B` is injected inside it. But the components don’t need to know about what’s used in other components. This mechanism had a mistake for custom elements: they were tracked globally. This commit fixes that, by tracking them scoped to the component that includes them. Related-to: GH-2100. Related-to: GH-2101. Closes GH-2112. Closes GH-2123. Co-authored-by: Caleb Eby <caleb.eby01@gmail.com> Co-authored-by: bholmesdev <hey@bholmes.dev>
- Loading branch information
1 parent
8970e21
commit 90fa493
Showing
2 changed files
with
47 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
90fa493
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
mdx – ./
mdx-mdx.vercel.app
mdx-git-main-mdx.vercel.app
mdxjs.com
v2.mdxjs.com