Integrate External, Read-Only Data Source Into Reactive System
Suppose the following:
How do I get that external event to trigger DOM updates and recall the getter?
https://playground.solidjs.com/anonymous/c937bc30-3d80-432c-814b-956ee3b58efa
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
10 Replies
so I have two ways:
plain old signal with explicit non-equal setter:
Tracker with vanilla getter:
So my follow up questions:
1. for very large external data, would using the Tracker method be more performant and memory efficient than the plain old signal method?
2. are there any lower level solutions?
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
memory wise it will be exactly the same
I just wouldn't use
<For/>
to loop through the data. since For is keyed on reference it would create a new html-element on each update (since the data coming in will be completely new each time, i assume).Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
so you could use Index
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
if you would still need to switch around rows, you might wanna use setStore with reconcile, but it comes with the cost of a diff and a proxy (and it sounds to me ur use case is more vast amounts of data coming in and needing to be visualised)
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
but ye, especially in ur example. memory would be exactly the same. you pass around this reference to this externalData-map. bit confused with the set-up ngl.
I'm wrapping a DB lib, it handles a cache that keeps the data in sync with the server
So I need to listen to changes on that cache in a reactive manor
my worry was that createSignal would somehow instance the data to make it reactive ( I forget how it works under the hood )
if that's not he case then all is good 👍
thx