Closed dabdine closed 1 year ago
Great thought. Hadn't thought of ignoring computations altogether if accessed values aren't used. Perhaps use of a Proxy object when passing state into the "computeState" function would let it listen to the accessed keys and then use shallow comparisons on those to skip the computation function.
I'll take a look in the morning with fresh eyes!
This is addressed by #3 and was released as version 1.3.0. Let me know if it works for your use case! Great suggestion!
@chrisvander awesome! I'll check it out, thanks!
Hello! Thanks for creating this library.
I would to be able to utilize selectors / dependencies as a third argument to
computed()
to determine when to run thecompute
function. As an example, in our use case, our store has a cursor x/y coordinate that is updated on mouse move. Thus, each pixel the mouse is moved forces a rerun of thecompute
function, which can be extremely costly.If I have time I'll push something. For now, i'm just tossing the idea up.