-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
#9669 introduced a warning for mutated nonstate that is referenced in the template. It shouldn't apply in cases like this, because the compiler should assume that obj.count could be an accessor:
<script>
let count = $state(0);
let obj = {
get count() {
return count;
},
set count(v) {
count = v;
}
}
function increment() {
obj.count += 1;
}
</script>
<button on:click={increment}>
clicks: {obj.count}
</button>In other words it should only apply to identifiers that aren't part of a MemberExpression, and only when the value is reassigned rather than simply mutated.
Reproduction
Logs
No response
System Info
nextSeverity
annoyance
vak0160, uribalb, umaranis and johangirod
Metadata
Metadata
Assignees
Labels
No labels