mirror of https://github.com/sveltejs/svelte
fix: prevent false positive non-state warnings for `bind:this` (#10674)
`bind:this` doesn't need to be a state reference if it will never change fixes #10435pull/10679/head
parent
1ac313594c
commit
74f8e261c6
@ -0,0 +1,3 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({});
|
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
let no_need;
|
||||
let does_need1;
|
||||
let does_need2 = $state();
|
||||
</script>
|
||||
|
||||
<div bind:this={no_need}></div>
|
||||
{#if true}
|
||||
<div bind:this={does_need1}></div>
|
||||
<div bind:this={does_need2}></div>
|
||||
{/if}
|
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"code": "non-state-reference",
|
||||
"message": "does_need1 is updated, but is not declared with $state(...). Changing its value will not correctly trigger updates.",
|
||||
"start": {
|
||||
"column": 5,
|
||||
"line": 3
|
||||
},
|
||||
"end": {
|
||||
"column": 15,
|
||||
"line": 3
|
||||
}
|
||||
}
|
||||
]
|
Loading…
Reference in new issue