Astro MDX fails to render framework components and components defined with MDX file, when explicit null
or undefined
prop passed in
#10575
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
Astro Info
(from stackblitz environment)
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
If a framework component is used within an MDX file, and one of its props gets passed in an explicit
undefined
ornull
, Astro crashes with an error trying to render the component.This issue also occurs for components defined within the MDX file.
e.g.
The problematic line is
astro/packages/astro/src/runtime/server/jsx.ts
Lines 118 to 119 in bb7707e
in these cases,
vnode
is an object, sorenderJSX
delegates torenderJSXNode
(this seems to be true of all the jsx inside an mdx file?)vnode['astro:jsx']
istrue
(i.e. it is in fact a vnode)vnode.type
is the component, i.e. a functionvnode.type
does not haveisAstroComponentFactory
setserver:root
propwhich leads to aforementioned line being called, resulting in attempting to do a property access on
null
/undefined
which results in an error.What's the expected result?
Component renders properly.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-mbbqqu?file=src%2Fpages%2Fa.mdx
Participation
The text was updated successfully, but these errors were encountered: