mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
fix $$props reactivity in fallback of a slot (#5375)
This commit is contained in:
parent
b1c67a16c6
commit
51e2626f42
@ -11,6 +11,7 @@
|
||||
* Fix using `<svelte:component>` in `{:catch}` ([#5259](https://github.com/sveltejs/svelte/issues/5259))
|
||||
* Fix setting one-way bound `<input>` `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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -0,0 +1 @@
|
||||
<slot />
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
import Foo from './Foo.svelte';
|
||||
</script>
|
||||
|
||||
<Foo>
|
||||
<slot>
|
||||
{JSON.stringify($$props)}
|
||||
</slot>
|
||||
</Foo>
|
18
test/runtime/samples/component-slot-fallback-6/_config.js
Normal file
18
test/runtime/samples/component-slot-fallback-6/_config.js
Normal file
@ -0,0 +1,18 @@
|
||||
// $$props reactivity in slot fallback
|
||||
export default {
|
||||
html: `
|
||||
<input>
|
||||
{"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, `
|
||||
<input>
|
||||
{"value":"abc"}
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import Inner from "./Inner.svelte";
|
||||
let value = '';
|
||||
</script>
|
||||
|
||||
<input bind:value />
|
||||
|
||||
<Inner {value} />
|
Loading…
Reference in New Issue
Block a user