skrebbel
skrebbel
SSolidJS
Created by gsoutz on 2/22/2024 in #support
How do I apply Css only for certain routes and then unload the effects on other routes
you can't ever unload css, so you gotta define the css such that it's correct for all pages. for example, make each page have a different class on the top level element, and set the variable in each class instead of on the root.
7 replies
SSolidJS
Created by skrebbel on 2/16/2024 in #support
captureStoreUpdates vs reconcile
thanks!
7 replies
SSolidJS
Created by hannus on 2/17/2024 in #support
is Index of Store that is array Signal?
protip: the "Output" tab on the SolidJS playground (https://playground.solidjs.com) is fantastic for grokking what's going on inside
15 replies
SSolidJS
Created by hannus on 2/17/2024 in #support
is Index of Store that is array Signal?
Finally, I believe that Solid will keep calling nested accessors when rendering, until it gets to a value. Try putting {() => () => () => index} in your JSX, it'll still work. So that's why passing index works: it's an accessor, and the JSX compiler lets you render accessors as if they're values.
15 replies
SSolidJS
Created by hannus on 2/17/2024 in #support
is Index of Store that is array Signal?
The reason you can write {index} instead of {index()} in the JSX is because Solid's JSX compiler is particularly tolerant. It compiles any expression to an a function call, unless it can see that the expression itself is a function call already. For example, <div>{props.foo}</div> gets compiled down to insert(divElement, () => props.foo) (insert is a Solid internal which, in an effect, sets the content of divElement to the result of the expression). Notice how props.foo became () => props.foo. Now, the compiler is simply smart enough to not prefix the () => when it can deduct that foo is itself an accessor. So in your case, {index} gets compiled to index and {index()} would also gets compiled to index. Only the latter will typecheck though, if you use TypeScript.
15 replies
SSolidJS
Created by hannus on 2/17/2024 in #support
is Index of Store that is array Signal?
Index is indeed an accessor. Thing is, when you delete item 3, then the index of items 4, 5, 6 etc get shifted one down! So the onClick callback needs to be recomputed, or it'd delete the wrong item when you delete 2 items subsequently.
15 replies
SSolidJS
Created by skrebbel on 2/16/2024 in #support
captureStoreUpdates vs reconcile
if you know your own data structure you may want to reconcile yourself by recursively diffing the current state and the new state to know where the changes need to happen
Right! OK so I think this means that I completely misunderstand what reconcile does - cause I thought it did exactly this! If it doesn't do "recursively diffing the current state", then what does it do? The way I read the docs (also misreading the merge parameter description) is that it walks both trees and applies any differences at the leaves to the value in the store. Sidenote: I really appreciate the work you did on deep! And the effort you're taking to respond to me! Thanks ❤️
7 replies
SSolidJS
Created by skrebbel on 2/10/2024 in #support
Derived data in a store vs reconcile
Right! This is very helpful, thanks!
7 replies
SSolidJS
Created by skrebbel on 2/10/2024 in #support
Derived data in a store vs reconcile
thanks 🙂 it hurts my OO-heart though 😿 I think that when our industry ditched OO for its mutable AbstractFactoryServiceProvider bathwater, we threw out the "couple data with operations on that data" baby. would be lovely IMO if caller code don't need to care whether something is raw data or a getter. also it means that if some code makes a mistake somewhere and reconciles the wrong level of the tree, all the getters are tossed. i recognize that reconcile is a crude tool not wielded lightly, but it still makes it all feel a little bit risky
7 replies