lemonad
lemonad
SSolidJS
Created by lemonad on 11/2/2024 in #support
CreateEffect and store properties
I have a store with a property xyz that is of type undefined | { a: number, b: number} and I ran into something I don't quite understand with createEffect. I pass store.xyz to a component as a prop and on changing the value, this triggers:
createEffect(() => {
console.log(props.xyz)
})
// > Proxy {a: 11, b: 2, Symbol(solid-proxy): Proxy, Symbol(store-node): Object}
createEffect(() => {
console.log(props.xyz)
})
// > Proxy {a: 11, b: 2, Symbol(solid-proxy): Proxy, Symbol(store-node): Object}
while this does not:
createEffect(() => {
console.log(props.xyz === undefined)
console.log("xyz")
})
// No output on change
createEffect(() => {
console.log(props.xyz === undefined)
console.log("xyz")
})
// No output on change
Is there an explanation for this behavior? I'm running 1.7.11 if that helps.
1 replies
SSolidJS
Created by lemonad on 10/31/2023 in #support
Loading screen for app
I'm a bit out of my depth with this question but essentially, I've got a Solid app running on embedded devices which in some rare cases have really poor wifi so the initial load of the page takes a long time without the user getting feedback on what's going on. I've been contemplating two solutions: one where I add a loader in JS that loads the solid app (but here the problem is that I don't quite know how to integrate this with Vite and everything) or one where a small part of the Solid app loads first and then the major part load later. I much prefer the second solution but then I run into the problem that I do not want all components lazy loaded individually (because the app might lose wifi later and then the available functionality depends on what parts the user have visited). I want everything else to be loaded as a single chunk if that makes sense. It seems like this might not be possible but I wanted to pose the question just in case. It is quite possible that I'm going about this entirely backwards so please let me know if there's some alternate solution I'm not thinking of : )
14 replies
SSolidJS
Created by lemonad on 3/8/2023 in #support
createStore array containing arrays
I have a store that is an array of objects where some properties are arrays. Then I do <For each={props.store}> {(item) => ( ... <For each={item.nested}> {(item2) => ( ... In an onClick handler, I modify a property of one of the elements in the nested array but it seems the second For loop is not seeing the update. I'm not particularly surprised by this but how would I setup something like this in order for it to work?
8 replies