fix(runtime): do not render empty Fragment (#2667)

This commit fixes the bug when returning an empty Fragment which makes
it undefined. This is because unescapeHTML (raw) will create a String object
with an 'undefined' string.

To fix this we need to check if the `children` is null or undefined
before marking a string as raw.
This commit is contained in:
Mateus Esdras 2022-02-28 19:03:28 -03:00 committed by GitHub
parent 046af36475
commit 8fb1f53e96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,6 +131,9 @@ export async function renderComponent(result: SSRResult, displayName: string, Co
const children = await renderSlot(result, slots?.default);
if (Component === Fragment) {
if (children == null) {
return children;
}
return unescapeHTML(children);
}