REEEEE
REEEEE
SSolidJS
Created by hyperknot on 2/22/2025 in #support
How to modify array partially?
Though I'm not 100% on that
10 replies
SSolidJS
Created by hyperknot on 2/22/2025 in #support
How to modify array partially?
I believe the key param is to uniquely identify objects by a property, the default key being id.
10 replies
SSolidJS
Created by hyperknot on 2/21/2025 in #support
Why does my component only update in a dummy For loop?
Nope
15 replies
SSolidJS
Created by hyperknot on 2/22/2025 in #support
How to modify array partially?
You can also use produce if you want to do mutation
setStore('streamingMarkdownTokens', produce(prevState => prevState.push(newItem)))
setStore('streamingMarkdownTokens', produce(prevState => prevState.push(newItem)))
10 replies
SSolidJS
Created by hyperknot on 2/22/2025 in #support
How to modify array partially?
reconcile would be the way to go. reconcile returns a function that takes in the previous state object. The store setter accepts a function as an argument where it provides you the previous value
setStore('streamingMarkdownToken', prevState => [...prevState, newItem])
setStore('streamingMarkdownToken', prevState => [...prevState, newItem])
Obviously creating a new array isn't ideal. You use reconcile here and it's equivalent to this
setStore('streamingMarkdownToken', prevState => reconcile(newTokens)(prevState))
setStore('streamingMarkdownToken', prevState => reconcile(newTokens)(prevState))
10 replies
SSolidJS
Created by hyperknot on 2/21/2025 in #support
Why does my component only update in a dummy For loop?
You can do this
const tokens = createMemo(() => {
return getMarkdownTokens(props.content)
})
const tokens = createMemo(() => {
return getMarkdownTokens(props.content)
})
OR
const tokens = () => {
return getMarkdownTokens(props.content)
}
const tokens = () => {
return getMarkdownTokens(props.content)
}
to make the read to props.content reactive. Since solid components don't generally rerun, once you read the prop (like in your original use), it gets that value at the time of read and that's it. Only effects, memos, jsx, and functions (for the most part) are reactive. If you read props or any reactive value in the body of the component it won't be reactive
15 replies
SSolidJS
Created by hyperknot on 2/21/2025 in #support
Why does my component only update in a dummy For loop?
You could use a normal function too or inline getMarkdownTokens(props.content) into the each
15 replies
SSolidJS
Created by hyperknot on 2/21/2025 in #support
Why does my component only update in a dummy For loop?
You can't do return props.content as it won't be reactive. It has to be read in jsx. So you can do return <> {props.content}</> to make it reactive
15 replies
SSolidJS
Created by hyperknot on 2/21/2025 in #support
Why does my component only update in a dummy For loop?
How are you reading the prop?
15 replies
SSolidJS
Created by KiaClouth on 2/17/2025 in #support
When I use blockly, nothing is on the page
Maybe you're missing the render function call?
11 replies
SSolidJS
Created by luis on 2/14/2025 in #support
SolidStart(?) useContext problem
Yes
6 replies
SSolidJS
Created by luis on 2/14/2025 in #support
SolidStart(?) useContext problem
in the ThemeProvider
6 replies
SSolidJS
Created by luis on 2/14/2025 in #support
SolidStart(?) useContext problem
You're destructuring props
6 replies
SSolidJS
Created by ⱼ ₒ ₑ on 2/14/2025 in #support
useContext is undefined
Also just make sure you don't destructure props
36 replies
SSolidJS
Created by ⱼ ₒ ₑ on 2/14/2025 in #support
useContext is undefined
I think if the route(s) aren't wrapped properly it's going to be undefined
36 replies
SSolidJS
Created by ⱼ ₒ ₑ on 2/14/2025 in #support
useContext is undefined
Is it undefined in the route?
36 replies
SSolidJS
Created by ⱼ ₒ ₑ on 2/14/2025 in #support
useContext is undefined
It could be that the route isn't able to access it because it's not wrapping it
36 replies
SSolidJS
Created by ⱼ ₒ ₑ on 2/14/2025 in #support
useContext is undefined
Where is DashboardProvider being used
36 replies
SSolidJS
Created by ⱼ ₒ ₑ on 2/14/2025 in #support
useContext is undefined
Is the SaveButton used in the props for DashboardProvider?
36 replies
SSolidJS
Created by ⱼ ₒ ₑ on 2/14/2025 in #support
useContext is undefined
Okay so some of the cases where it could be undefined are: - Used useContext inside an event handler - Initiated/created the component outside the provider - During hmr in some cases
36 replies