From e648c5575a8774af739231cfa9fc27a32086aa5f Mon Sep 17 00:00:00 2001 From: duanwilliam <38791932+duanwilliam@users.noreply.github.com> Date: Fri, 29 Mar 2024 03:14:25 -0700 Subject: [PATCH] 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 --- .changeset/forty-turkeys-tap.md | 5 +++++ packages/astro/src/runtime/server/jsx.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/forty-turkeys-tap.md diff --git a/.changeset/forty-turkeys-tap.md b/.changeset/forty-turkeys-tap.md new file mode 100644 index 000000000000..f7d6609abe8b --- /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 b2aca1783264..81bae422f09a 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]; }