You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new rule reports usage of ref objects that can lead to loss of reactivity.
What category should the rule belong to?
[ ] Enforces code style (layout)
[X] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
// Ref Objectconstcount=ref(0)constcnt1=count.value/* ✗ BAD */const{value: cnt2}=count/* ✗ BAD */constcnt3=computed(()=>count.value/* ✓ GOOD */)constvalue1=fn(count.value)/* ✗ BAD */constvalue2=fn(count)/* ✓ GOOD */constvalue3=computed(()=>fn(count.value)/* ✓ GOOD */)
// Reactivity Transformconstcount=$ref(0)constcnt1=count/* ✗ BAD */constcnt2=computed(()=>count/* ✓ GOOD */)constvalue1=fn(count)/* ✗ BAD */constvalue2=fn($$(count))/* ✓ GOOD */constvalue3=computed(()=>fn(count)/* ✓ GOOD */)
Additional context
I think it's useful for users who use Reactivity Transform because it prevents them from forgetting to add $$().
So it is related to Reactivity Transform #1948.
Regarding Reactive Objects, the following code loses its reactivity:
Please describe what the rule should do:
A new rule reports usage of ref objects that can lead to loss of reactivity.
What category should the rule belong to?
[ ] Enforces code style (layout)
[X] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
Additional context
I think it's useful for users who use Reactivity Transform because it prevents them from forgetting to add
$$()
.So it is related to Reactivity Transform #1948.
Regarding Reactive Objects, the following code loses its reactivity:
But when count is an object, it may not lose reactivity, so it's hard to report:
The text was updated successfully, but these errors were encountered: