summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar duanwilliam <38791932+duanwilliam@users.noreply.github.com> 2024-03-29 03:14:25 -0700
committerGravatar GitHub <noreply@github.com> 2024-03-29 10:14:25 +0000
commite648c5575a8774af739231cfa9fc27a32086aa5f (patch)
tree26aaca452dc36e87bf58bd56853eca93afe69d0a
parent0ff5d72c7841e10065d37b43322358f4a48b7e95 (diff)
downloadastro-e648c5575a8774af739231cfa9fc27a32086aa5f.tar.gz
astro-e648c5575a8774af739231cfa9fc27a32086aa5f.tar.zst
astro-e648c5575a8774af739231cfa9fc27a32086aa5f.zip
fix: dont error on nullish prop values in jsx runtime (#10584)
* fix: prevent jsx runtime from erroring on nullish prop values when checking for slot props * chore: changeset
-rw-r--r--.changeset/forty-turkeys-tap.md5
-rw-r--r--packages/astro/src/runtime/server/jsx.ts2
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/forty-turkeys-tap.md b/.changeset/forty-turkeys-tap.md
new file mode 100644
index 000000000..f7d6609ab
--- /dev/null
+++ b/.changeset/forty-turkeys-tap.md
@@ -0,0 +1,5 @@
+---
+"astro": patch
+---
+
+Fixes a bug where JSX runtime would error on components with nullish prop values in certain conditions.
diff --git a/packages/astro/src/runtime/server/jsx.ts b/packages/astro/src/runtime/server/jsx.ts
index b2aca1783..81bae422f 100644
--- a/packages/astro/src/runtime/server/jsx.ts
+++ b/packages/astro/src/runtime/server/jsx.ts
@@ -116,7 +116,7 @@ Did you forget to import the component or is it possible there is a typo?`);
}
extractSlots(children);
for (const [key, value] of Object.entries(props)) {
- if (value['$$slot']) {
+ if (value?.['$$slot']) {
_slots[key] = value;
delete props[key];
}