diff --git a/packages/svelte/src/internal/client/reactivity/props.js b/packages/svelte/src/internal/client/reactivity/props.js index 9934277be4..a74cbc4d15 100644 --- a/packages/svelte/src/internal/client/reactivity/props.js +++ b/packages/svelte/src/internal/client/reactivity/props.js @@ -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; diff --git a/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/Child.svelte b/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/Child.svelte new file mode 100644 index 0000000000..f65cd15e3b --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/Child.svelte @@ -0,0 +1,6 @@ + + +{x} {y} \ No newline at end of file diff --git a/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/_config.js b/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/_config.js new file mode 100644 index 0000000000..71e4294705 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/_config.js @@ -0,0 +1,5 @@ +import { test } from '../../test'; + +export default test({ + html: '0 0' +}); diff --git a/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/main.svelte b/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/main.svelte new file mode 100644 index 0000000000..e4389862c9 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/prop-p-is-null/main.svelte @@ -0,0 +1,5 @@ + + + \ No newline at end of file