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
createRoot
createSignal
createMemo
createEffect
untrack
tick - flushes effects
getOwner
runWithOwner
onError
onDispose
context missing but lookup is there to easily add it
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):
✅ not running effect if owner is found to be dirty (currently refer to this as a zombie effect and we check by looking up owner tree before running each)
✅ stale error on throw - remains dirty and if the error is not handled it will run cleanup
❓ diamond graph - I had temp removed when porting from Reactively as my tests showed no change in behaviour. We can run further tests to see if this is an issue.
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.
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
createRoot
createSignal
createMemo
createEffect
untrack
tick
- flushes effectsgetOwner
runWithOwner
onError
onDispose
lookup
is there to easily add itThe 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 anOwner
orComputation
. 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
):Reactive.constructor
->createComputation
Reactive.get
->read
Reactive.set
->write
Reactive.stale
->notify
Reactive.update
->update
Reactive.updateIfNecessary
->shouldUpdate
updateIfNecessary
Reactive.removeParentObservers
->removeSourceObservers
Reactive.destroy
->dispose
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.