From 8fb1f53e96f9fdb0df0ee075cf77e5154b045e5f Mon Sep 17 00:00:00 2001 From: Mateus Esdras Date: Mon, 28 Feb 2022 19:03:28 -0300 Subject: [PATCH] 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. --- packages/astro/src/runtime/server/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index f44f14926..52d19fd87 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -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); }