You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on own reactivity library and first used same approach as I saw in Solid (to store dependencies between reactive atoms) with 4 arrays: observers, observerSlots, sources, sourceSlots. when I noticed that I don't use observerSlots I removed it and saw that reactivity in my library still works!
marked with green line:1630 where it's read, line:1634 is where it is written. but there is no other reads
note: this property might be still useful if we would need to remove all observers (not all sources which is what cleanNode does) or to remove specific observer
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I noticed that
observerSlots
property that is set inreadSignal
function only used for read it one place - incleanNode
, but how it is used - it is just saved to another indexhttps://github.com/solidjs/solid/blob/main/packages/solid/src/reactive/signal.ts#L1276 (set
observerSlots
, also line:1279)https://github.com/solidjs/solid/blob/main/packages/solid/src/reactive/signal.ts#L1630 (read of
observerSlots
)I'm working on own reactivity library and first used same approach as I saw in Solid (to store dependencies between reactive atoms) with 4 arrays:
observers
,observerSlots
,sources
,sourceSlots
. when I noticed that I don't useobserverSlots
I removed it and saw that reactivity in my library still works!marked with green
line:1630
where it's read,line:1634
is where it is written. but there is no other readsnote: this property might be still useful if we would need to remove all observers (not all sources which is what
cleanNode
does) or to remove specific observerBeta Was this translation helpful? Give feedback.
All reactions