Skip to content

Commit

Permalink
fix: dont error on nullish prop values in jsx runtime (#10584)
Browse files Browse the repository at this point in the history
* fix: prevent jsx runtime from erroring on nullish prop values when checking for slot props

* chore: changeset
  • Loading branch information
duanwilliam authored Mar 29, 2024
1 parent 0ff5d72 commit e648c55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/forty-turkeys-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes a bug where JSX runtime would error on components with nullish prop values in certain conditions.
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit e648c55

Please sign in to comment.