mirror of https://github.com/sveltejs/svelte
warn if component is expected to be reactive (#4409)
parent
6250046c05
commit
fdc89ebb62
@ -0,0 +1,18 @@
|
||||
<script>
|
||||
import A from './A.svelte';
|
||||
import B from './B.svelte';
|
||||
|
||||
let Let = A;
|
||||
function update() {
|
||||
Let = B;
|
||||
}
|
||||
|
||||
export let ExportLet = B;
|
||||
|
||||
$: Reactive = random() ? A : B;
|
||||
</script>
|
||||
|
||||
<Let />
|
||||
<ExportLet />
|
||||
<Reactive />
|
||||
<svelte:component this={Let} />
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"generate": true
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
[
|
||||
{
|
||||
"code": "reactive-component",
|
||||
"message": "<Let/> will not be reactive if Let changes. Use <svelte:component this={Let}/> if you want this reactivity.",
|
||||
"pos": 190,
|
||||
"end": {
|
||||
"character": 197,
|
||||
"column": 7,
|
||||
"line": 15
|
||||
},
|
||||
"start": {
|
||||
"character": 190,
|
||||
"column": 0,
|
||||
"line": 15
|
||||
}
|
||||
},
|
||||
{
|
||||
"message": "<ExportLet/> will not be reactive if ExportLet changes. Use <svelte:component this={ExportLet}/> if you want this reactivity.",
|
||||
"code": "reactive-component",
|
||||
"pos": 198,
|
||||
"end": {
|
||||
"character": 211,
|
||||
"column": 13,
|
||||
"line": 16
|
||||
},
|
||||
"start": {
|
||||
"character": 198,
|
||||
"column": 0,
|
||||
"line": 16
|
||||
}
|
||||
},
|
||||
{
|
||||
"message": "<Reactive/> will not be reactive if Reactive changes. Use <svelte:component this={Reactive}/> if you want this reactivity.",
|
||||
"code": "reactive-component",
|
||||
"pos": 212,
|
||||
"end": {
|
||||
"character": 224,
|
||||
"column": 12,
|
||||
"line": 17
|
||||
},
|
||||
"start": {
|
||||
"character": 212,
|
||||
"column": 0,
|
||||
"line": 17
|
||||
}
|
||||
}
|
||||
]
|
Loading…
Reference in new issue