Protect again no metadata being passed (#644)

If using Astro <= 0.17.0 there is no `metadata` being passed. Even though no one should be using that version with this, adding some extra protection just in case.
This commit is contained in:
Matthew Phillips 2021-07-09 09:40:42 -04:00 committed by GitHub
parent e70d9508d9
commit 44a69f7dcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,7 +37,7 @@ function check(Component, props, children) {
function renderToStaticMarkup(Component, props, children, metadata) {
const vnode = h(Component, { ...props, children: h(StaticHtml, { value: children }), innerHTML: children });
let html;
if (metadata.hydrate) {
if(metadata && metadata.hydrate) {
html = renderToString(vnode);
} else {
html = reactRenderToStaticMarkup(vnode);