solidjs / signals

MIT License
144 stars 4 forks source link

initial port of maverick to x-reactively #1

Closed mihar-22 closed 1 year ago

mihar-22 commented 1 year ago

There's a bunch of stuff to do before this repo/package is ready and trying to port everything from Maverick over or perfectly matching Solid API in one hit is far too hard.

I thought a good place to start is just copying over most of the core (in src/wip dir) so we can walk through it and discuss things. I tried to match the existing API but it is rough. I'd love to hear where everyone thinks is a good place to go from here.

Current API

The source/observer tracking scheme is identical to Reactively with some minor refactoring to fit with the owner tracking system. As mentioned before, owner tracking uses a linked list that contains _parent, _nextSibling, _prevSibling on an Owner or Computation. All children appear to the right of their parent in the list with children being appended to a parent. This means children are from last to first (reverse order) - perfect for disposing.

Reactively refactor map (mentioned functions on the right can be found in src/wip/core.ts):

Known Edge Cases

I'm sure Milo and Ryan know a bunch more that I'm missing here, we can list them out and add tests for all. On that note I have a pretty good test suite in Maverick but I haven't ported it yet. We can get that all setup after this initial review.