summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Edo-San <edo.sandon@gmail.com> 2023-06-08 22:58:17 +0200
committerGravatar GitHub <noreply@github.com> 2023-06-08 15:58:17 -0500
commit52f0480d14c328ab69bd1f2681ddfd83f7385ab1 (patch)
treeeaf56178f4dee69d3f2e544a6b52cac39797b49e
parente6bff651ff80466b3e862e637d2a6a3334d8cfda (diff)
downloadastro-52f0480d14c328ab69bd1f2681ddfd83f7385ab1.tar.gz
astro-52f0480d14c328ab69bd1f2681ddfd83f7385ab1.tar.zst
astro-52f0480d14c328ab69bd1f2681ddfd83f7385ab1.zip
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 <natemoo-re@users.noreply.github.com>
-rw-r--r--.changeset/blue-spies-live.md5
-rw-r--r--packages/astro/src/runtime/server/index.ts2
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/blue-spies-live.md b/.changeset/blue-spies-live.md
new file mode 100644
index 000000000..9fef9819c
--- /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 b7542d39b..564ebbe91 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 `<Component {...value} />
export function spreadAttributes(
- values: Record<any, any>,
+ values: Record<any, any> = {},
_name?: string,
{ class: scopedClassName }: { class?: string } = {}
) {