mirror of https://github.com/sveltejs/svelte
warn-attachments-legacy-member-access
parent
42e7e8168d
commit
fc896a779f
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: add warning when you read object property within attachments in legacy mode
|
@ -0,0 +1,14 @@
|
|||||||
|
<script>
|
||||||
|
let state = {
|
||||||
|
count: 0,
|
||||||
|
attachment(){
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={()=>{
|
||||||
|
state.count++;
|
||||||
|
}}>{state.count}</button>
|
||||||
|
|
||||||
|
<div {@attach state.attachment}></div>
|
@ -0,0 +1,14 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "attachment_legacy_member_access",
|
||||||
|
"message": "Using `@attach` with a function from an object in legacy mode can cause unnecessary reruns of the attachment function if you mutate that object.",
|
||||||
|
"start": {
|
||||||
|
"line": 14,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 14,
|
||||||
|
"column": 30
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in new issue