top | item 29394990

(no title)

disease | 4 years ago

Reading this I'm reminded of knockoutjs, which the author of SolidJS cites as an influence. I remember at one point, years ago, trying to figure out why it was so much faster than AngularJS. Two things seemed to be going on: 1) It was only updating the parts of the DOM it needed to 2) To do this it seemed to 'automagically' be inferring dependencies.

I wondered how they did this second thing and guessed that it was parsing the JS code I was writing somehow. Either that or flooding the observables with values and making note of how changes trickle down. It turned out that it was doing neither of those things but frankly I didn't understand how it worked even when it was explained to me. Might be a good time to revisit and satiate my curiosity and take another look at it.

discuss

order

nsonha|4 years ago

It just tracks function calls. The general idea is that if a function is called in the render cycle of a component, that registers as a subscription for that piece of data that function returns. There is some magic with proxy and getter to hide the functions but basically that's it.