Closed Qsppl closed 3 weeks ago
You must not use setters inside of the value
function - as may create an endless loop of actions. You should use the observe
method, to take action when one property change should influence another.
However, thanks for pointing it out, I made a fix and released a new version, which will throw for your example code.
Instead of setting a value while getting another, you should use observe
:
{
one: {
value: 0,
observe: (host, value) => { host.two = value },
},
two: 0,
}
Thank you, now it has become much easier to notice the error and understand why it occurred.
example: https://codepen.io/qsppl/pen/WNqXLGO
The observed behavior is not obvious. The first time library users encounter this behavior, it will be confusing.