Why should the Effect itself hold a list of dependencies as well. The Signal holds a list of subscriptions that should be notified whenever the signal is modified, for example setCount(5), And that does the job right ? what am I missing ? In the code above effect's dependencies are being added but not really used anywhere except for cleaning itself but why do they exist in the first place).
In VueJS there is a hijacking of the state (data) itself and so at initialization the data properties are being replaced with reactive getters and setters (using defineProperty in the past and Proxy today) that notify listeners. In SolidJS is there hijacking as well ? or is it mostly 'pure functional' ?
In the code above effect's dependencies are being added but not really used anywhere except for cleaning itself
That is why. Each Effect needs to unsubscribe itself on cleanup/re-run. We need to know since the Signal holds the subscriptions. A long lived Signal could fire an Effect indefinitely otherwise long after it should be disposed.
Solid has proxies but the prefered pattern is createStore which creates a readonly proxy and setter function combo. There is a createMutable like MobX/Vue available though.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Ryan, Thanks for this post !
Why should the Effect itself hold a list of dependencies as well. The Signal holds a list of subscriptions that should be notified whenever the signal is modified, for example setCount(5), And that does the job right ? what am I missing ? In the code above effect's dependencies are being added but not really used anywhere except for cleaning itself but why do they exist in the first place).
In VueJS there is a hijacking of the state (data) itself and so at initialization the data properties are being replaced with reactive getters and setters (using defineProperty in the past and Proxy today) that notify listeners. In SolidJS is there hijacking as well ? or is it mostly 'pure functional' ?
Thanks !