Andreas Roth
Store with const obj values passed to it does not update.
Maybe to give an explanation:
Internally, solid.js like to mutate things. By only updating instead of re-creating solid can achieve its finegrained reactivity.
In your case, your initial object is mutated by solid as it's passed as the initial state to createStore.
Thus, after you changed your UI, initialViewable is also changed.
By creating a new object that you pass to createStore, the original object stays unchanged and can be used to properly reset.
11 replies
Cycles in dependency graph
The general idea seems to work great 🙂
https://playground.solidjs.com/anonymous/9ae5490a-2034-4ebd-a276-19388d0f2b41
14 replies
best way to update multiple children in a multi timer app?
Solid is still a declarative framework. You don't imperatively call functions on children.
You pass data down, and let the children decide what they want to do.
So your parant would manage the time and would pass the time value down to children and if children need to manipulate the time (like reset, stop, start etc.) you simply pass down functions from the parent to the child.
https://playground.solidjs.com/anonymous/9d2a881b-f396-487e-ad93-35ea7f34673f
2 replies
How can I make createEffect in SolidJS execute only when the dependency variable changes, and not wh
(Maybe a bit late, but anyways):
I think this pattern is a code smell. This directly points us to move the logic into the event handler...
18 replies
Seemingly random hydration mismatches
The div/p thing is what causes these errors.
When getting the plain html, the browser assumes that div inside of a p is an error, closes the p and opens a new div.
Once solid hydrates it sees this, complains, and tries to fix it. So when you look in devtools it will be correct. If you disable JS or only look at the returned static html, you will see another structure.
6 replies
function prop destructure
No it's not...
What if someone uses the component in a way that changes the accessor?
We should never break reactivity just because it works in some cases... If you can break the component by "using it wrong", the component implementation is broken
21 replies
Virtual Scrolling with animation and dynamic loading
I suggest not using overflow: hidden, but overflow scroll with scroll snap.
You can then do some css shenanigangs to hide the scrollbar visually, but the setup will automatically work with horizontal mouse wheels, trackpads or touch screens.
5 replies