First of all, thank you so much for this library. 🤩 👏
But is it by design that the callback is called not just when one of the specified properties change, but also when the observer is initially attached to an element? If so, is there any way around that?
My use case is a React component that changes the state of one of its ancestors via context when a custom property changes inside it, but because the callback is called initially as well, it causes an infinite render loop.
Simple reproduction in CodeSandbox (basically the same example you have in the README but in a React/TS project because I had errors when trying in a vanilla JS project for some reason; see how values is logged on load)
First of all, thank you so much for this library. 🤩 👏
But is it by design that the callback is called not just when one of the specified properties change, but also when the observer is initially attached to an element? If so, is there any way around that?
My use case is a React component that changes the state of one of its ancestors via context when a custom property changes inside it, but because the callback is called initially as well, it causes an infinite render loop.
Simple reproduction in CodeSandbox (basically the same example you have in the README but in a React/TS project because I had errors when trying in a vanilla JS project for some reason; see how
valuesis logged on load)