diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ccfeff273..19e8cced8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Fix using `` in `{:catch}` ([#5259](https://github.com/sveltejs/svelte/issues/5259)) * Fix setting one-way bound `` `value` to `undefined` when it has spread attributes ([#5270](https://github.com/sveltejs/svelte/issues/5270)) * Fix deep two-way bindings inside an `{#each}` involving a store ([#5286](https://github.com/sveltejs/svelte/issues/5286)) +* Fix reactivity of `$$props` in slot fallback content ([#5367](https://github.com/sveltejs/svelte/issues/5367)) ## 3.24.1 diff --git a/src/compiler/compile/render_dom/wrappers/shared/is_dynamic.ts b/src/compiler/compile/render_dom/wrappers/shared/is_dynamic.ts index d32ebe4594..aca2096154 100644 --- a/src/compiler/compile/render_dom/wrappers/shared/is_dynamic.ts +++ b/src/compiler/compile/render_dom/wrappers/shared/is_dynamic.ts @@ -1,9 +1,11 @@ import { Var } from '../../../../interfaces'; +import { is_reserved_keyword } from '../../../utils/reserved_keywords'; export default function is_dynamic(variable: Var) { if (variable) { if (variable.mutated || variable.reassigned) return true; // dynamic internal state if (!variable.module && variable.writable && variable.export_name) return true; // writable props + if (is_reserved_keyword(variable.name)) return true; } return false; diff --git a/test/runtime/samples/component-slot-fallback-6/Foo.svelte b/test/runtime/samples/component-slot-fallback-6/Foo.svelte new file mode 100644 index 0000000000..0385342cef --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-6/Foo.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/runtime/samples/component-slot-fallback-6/Inner.svelte b/test/runtime/samples/component-slot-fallback-6/Inner.svelte new file mode 100644 index 0000000000..28f0fdd869 --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-6/Inner.svelte @@ -0,0 +1,9 @@ + + + + + {JSON.stringify($$props)} + + diff --git a/test/runtime/samples/component-slot-fallback-6/_config.js b/test/runtime/samples/component-slot-fallback-6/_config.js new file mode 100644 index 0000000000..fb1a658f26 --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-6/_config.js @@ -0,0 +1,18 @@ +// $$props reactivity in slot fallback +export default { + html: ` + + {"value":""} + `, + + async test({ assert, target, window }) { + const input = target.querySelector("input"); + input.value = "abc"; + await input.dispatchEvent(new window.Event('input')); + + assert.htmlEqual(target.innerHTML, ` + + {"value":"abc"} + `); + } +}; diff --git a/test/runtime/samples/component-slot-fallback-6/main.svelte b/test/runtime/samples/component-slot-fallback-6/main.svelte new file mode 100644 index 0000000000..35abebef10 --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-6/main.svelte @@ -0,0 +1,8 @@ + + + + +