Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mdx-loader): properly unwrap mdxAdmonitionTitle placeholder #8246

Merged
merged 2 commits into from Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -19,10 +19,10 @@ function extractMDXAdmonitionTitle(children: ReactNode): {
React.isValidElement(item) &&
(item.props as {mdxType: string} | null)?.mdxType ===
'mdxAdmonitionTitle',
);
) as JSX.Element | undefined;
const rest = <>{items.filter((item) => item !== mdxAdmonitionTitle)}</>;
return {
mdxAdmonitionTitle,
mdxAdmonitionTitle: mdxAdmonitionTitle?.props.children,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey

Actually the template trick seems un-necessary: you just found the issue here

See prod markup:

https://docusaurus.io/tests/pages/markdownPageTests#admonitions

CleanShot 2022-10-26 at 17 58 28@2x

The utils code does not unwrap the element and still let it pass through up to the React reconcilier (which emits the warning)

Just adding this line fixes the issue

Copy link
Collaborator Author

@Josh-Cena Josh-Cena Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, great find! Let me try

rest,
};
}
Expand Down