fix: only validate when components is defined
This commit is contained in:
parent
6e8ba96da9
commit
73af50ba20
1 changed files with 4 additions and 2 deletions
|
@ -7,13 +7,15 @@ import RenderNode from './RenderNode.astro';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
content: RenderableTreeNode;
|
content: RenderableTreeNode;
|
||||||
components: Record<string, AstroInstance['default']>;
|
components?: Record<string, AstroInstance['default']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const { content, components } = Astro.props as Props;
|
const { content, components } = Astro.props as Props;
|
||||||
|
|
||||||
// Will throw if components is invalid
|
// Will throw if components is invalid
|
||||||
|
if (components) {
|
||||||
validateComponentsProp(components);
|
validateComponentsProp(components);
|
||||||
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
<RenderNode node={createAstroNode(content, components)} />
|
<RenderNode node={createAstroNode(content, components)} />
|
||||||
|
|
Loading…
Reference in a new issue