From 52f0480d14c328ab69bd1f2681ddfd83f7385ab1 Mon Sep 17 00:00:00 2001 From: Edo-San Date: Thu, 8 Jun 2023 22:58:17 +0200 Subject: [PATCH] Fix/update spread attribute (#7310) * fix: add default fallback for spreadAttributes values * chore: add PR changeset * chore: fix pnpm lock --------- Co-authored-by: Nate Moore --- .changeset/blue-spies-live.md | 5 +++++ packages/astro/src/runtime/server/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/blue-spies-live.md diff --git a/.changeset/blue-spies-live.md b/.changeset/blue-spies-live.md new file mode 100644 index 000000000000..9fef9819cce4 --- /dev/null +++ b/.changeset/blue-spies-live.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixed a bug that threw an Exception when spreading potentially undefined values as HTML attributes diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index b7542d39bbaa..564ebbe91814 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -69,7 +69,7 @@ export function __astro_tag_component__(Component: unknown, rendererName: string // Adds support for ` export function spreadAttributes( - values: Record, + values: Record = {}, _name?: string, { class: scopedClassName }: { class?: string } = {} ) {