From c56a9227c717480ef4cf25cd50634872ef021101 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Fri, 5 Aug 2022 17:12:18 -0500 Subject: [PATCH] Fix [Object object] in MDX output (#4180) * fix: use stringifyChunk in `renderToString` fn * chore: add changeset Co-authored-by: Nate Moore --- .changeset/purple-mirrors-smile.md | 5 +++++ packages/astro/src/runtime/server/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/purple-mirrors-smile.md diff --git a/.changeset/purple-mirrors-smile.md b/.changeset/purple-mirrors-smile.md new file mode 100644 index 000000000..879c45058 --- /dev/null +++ b/.changeset/purple-mirrors-smile.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix edge case where Astro component would render [Object object] when using MDX diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index 9a655d380..150937a9d 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -752,7 +752,7 @@ export async function renderToString( let html = ''; for await (const chunk of renderAstroComponent(Component)) { - html += chunk; + html += stringifyChunk(result, chunk); } return html; }