Skip to content

Commit

Permalink
fix: check for falsy values in spread (#11388)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
  • Loading branch information
3 people committed May 10, 2024
1 parent f70c037 commit f219c79
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/svelte/src/internal/client/reactivity/props.js
Expand Up @@ -169,7 +169,7 @@ const spread_props_handler = {
has(target, key) {
for (let p of target.props) {
if (is_function(p)) p = p();
if (key in p) return true;
if (p != null && key in p) return true;
}

return false;
Expand Down
@@ -0,0 +1,6 @@
<script>
$: x = Object.keys($$restProps).length;
$: y = Object.keys($$props).length;
</script>

{x} {y}
@@ -0,0 +1,5 @@
import { test } from '../../test';

export default test({
html: '0 0'
});
@@ -0,0 +1,5 @@
<script>
import Child from './Child.svelte'
</script>

<Child {...undefined} />

0 comments on commit f219c79

Please sign in to comment.