REEEEE
REEEEE
SSolidJS
Created by Rinma on 6/30/2024 in #support
How to get snapshot value from store
You can use unwrap on the store object before you pass it to parseFile to get the object without the proxy parseFile(unwrap(listState.list))
4 replies
SSolidJS
Created by Greenman999 on 6/22/2024 in #support
this is undefined
You have to use useAction
4 replies
SSolidJS
Created by ile on 6/19/2024 in #support
Beginner question about signals
np
4 replies
SSolidJS
Created by ile on 6/19/2024 in #support
Beginner question about signals
wrap the return in a fragment
4 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
Maybe worth a mention to the docs team
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
No problem It's mentioned here a bit on the new docs for general reactivity: https://docs.solidjs.com/concepts/intro-to-reactivity But the tutorial on the main site might be more beneficial
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
But if you did this instead
const context = useContext(FoobarContext)!;

...

<p>{context.name}</p>
const context = useContext(FoobarContext)!;

...

<p>{context.name}</p>
It will be reactive
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
<FoobarContext.Provider
value={{
get name(){
return store.name
},
changeName: () => {
setStore("name", "john");
},
}}
>
{props.children}
</FoobarContext.Provider>
<FoobarContext.Provider
value={{
get name(){
return store.name
},
changeName: () => {
setStore("name", "john");
},
}}
>
{props.children}
</FoobarContext.Provider>
This will work because the property is read inside a function (the object getter) but when you do
const { name, changeName } = useContext(FoobarContext)!;
const { name, changeName } = useContext(FoobarContext)!;
It will call the name getter and only give you the value it was at that moment and won't react to changes to store.name
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
Yup
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
Each value in a store is a signal underneath, once you read a property the signal is called and you have the value
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
again, you've read the value and nothing will be tracked
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
The solution I would go with is to pass the store to the context instead if you need all the values. Otherwise you can use object getters but you won't be able to destructure the context like you've done. Or make functions to get specific properties from the store
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
as for why the signal works, if you're simply passing the signal along via value={{signalValue, changeName(){}}} and reading it as
const { signalValue, changeName } = useContext(FoobarContext)

...
<p> {signalValue().name} </p>
const { signalValue, changeName } = useContext(FoobarContext)

...
<p> {signalValue().name} </p>
then that will work just fine because the signal is called in a place where reactivity is preserved, the jsx. If you did this though, value={{...signalValue(), changeName(){}}}, this wouldn't work because you're assigning the values to the value prop and the value prop isn't reactive
18 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
If you spread the store like that to the context, you've effectively read the values and thus disabled reactivity because the underlying functions of the store that were managing the reactivity have been called
18 replies
SSolidJS
Created by SomeRandomNiko on 6/17/2024 in #support
Reactivity issues with array items
But anyway, as for stores, whatever you read is tracked. So in this case, since you're reading waypoint in containsWithWaypoints, it will be tracked. If you want another property to be tracked, you'll have to read it in the loop somewhere
10 replies
SSolidJS
Created by SomeRandomNiko on 6/17/2024 in #support
Reactivity issues with array items
wait, you do want the effect to run when the input changes?
10 replies
SSolidJS
Created by SomeRandomNiko on 6/17/2024 in #support
Reactivity issues with array items
In this case, you could just untrack the container.waypoint or c.waypoint
10 replies
SSolidJS
Created by enteleform on 6/16/2024 in #support
Broken reactivity @ `vite-plugin-solid` with `{dev:false}`, but works fine with `{dev:true}`.
Could be an issue with the component being a web component and not playing well with the setup
39 replies
SSolidJS
Created by enteleform on 6/16/2024 in #support
Broken reactivity @ `vite-plugin-solid` with `{dev:false}`, but works fine with `{dev:true}`.
The issue is only for the Icon component specifically right?
39 replies
SSolidJS
Created by enteleform on 6/16/2024 in #support
Broken reactivity @ `vite-plugin-solid` with `{dev:false}`, but works fine with `{dev:true}`.
Not too sure tbh, it could be that {dev:true} force rerenders
39 replies