foolswisdom
foolswisdom
SSolidJS
Created by webstrand on 10/22/2024 in #support
How are you supposed to satisfy refs when not forwarding to a pure DOM node?
I expect there's nothing built in. The types are often written with elements in mind, reusing them for components may not be feasible. In some cases it makes sense to adjust the existing types (make a PR), sometimes not
6 replies
SSolidJS
Created by webstrand on 10/22/2024 in #support
How are you supposed to satisfy refs when not forwarding to a pure DOM node?
The compiler behavior applies to any prop named ref, iirc
6 replies
SSolidJS
Created by webstrand on 10/22/2024 in #support
How are you supposed to satisfy refs when not forwarding to a pure DOM node?
The ref prop received will be a function, even if the type passed to the ref prop is a variable (the compiler will simply create a function that takes a value and assigns to that variable). The Ref type allows for both, because it's defined in terms of the type that can be passed. If you don't like that, you should use a different type. The reason the type includes undefined is because you explicitly added undefined to the type generic passed to Ref, so of course TS says it's possibly undefined
6 replies
SSolidJS
Created by Mr Void on 9/16/2024 in #support
Reset signals when prop value changes
Anyway, if it works it works
8 replies
SSolidJS
Created by Mr Void on 9/16/2024 in #support
Reset signals when prop value changes
Not quite a fit
8 replies
SSolidJS
Created by Mr Void on 9/16/2024 in #support
Reset signals when prop value changes
Nah, I didn't quite realize your use case
8 replies
SSolidJS
Created by Mr Void on 9/16/2024 in #support
Reset signals when prop value changes
Generally speaking, what you're looking for is a writeableMemo. I believe #solid-primitives has an implementation you can use
8 replies
SSolidJS
Created by microsoft on 8/29/2024 in #support
Help understanding createResource
When using suspense, you need to use the error boundary component, not use the error property of the resource
4 replies
SSolidJS
Created by gsoutz on 7/16/2024 in #support
createResource signal isn't trigger if undefined or null
Also in the docs https://docs.solidjs.com/reference/basic-reactivity/create-resource
fetchData will be called as soon as source has any value other than false, null, or undefined.
Feels like it could be better surfaced if also described not as part of a snippet
3 replies
SSolidJS
Created by flippyflops on 6/18/2024 in #support
Reactivity in store
And specifically, tracking the signal of a given property occurs at the location of property access
18 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
In that case, if the select component access those functions at the top level, that would cause the problem
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
Do this instead
function Select(props) {}
function Select(props) {}
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
Which is to say, this would be a problem:
function Select({placeholder, onChange, loading, ...props}) {}
function Select({placeholder, onChange, loading, ...props}) {}
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
If you are destructuring in the definition of Select, that could be a problem, for example, but that code isn't shown
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
If it isn't working it isn't because of the code shown. Something is wrong somewhere else
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
I'm not sure what could be more elegant
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
In case it wasn't clear from what I wrote, this is expected to work
<Select
placeholder="Select a running app"
onChange={setSelectedAppProcess}
loading={openedAppsOptions().length === 0}
{...props}
{...filterableOptionsProps()}
/>
<Select
placeholder="Select a running app"
onChange={setSelectedAppProcess}
loading={openedAppsOptions().length === 0}
{...props}
{...filterableOptionsProps()}
/>
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
In your example above, the correct way to do it is as shown in your first code snippet. No changes are necessary
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
The reason for the difference is that the compiler changes the semantics of the spread in jsx. Similar to how props in general are transformed into objects getters
17 replies
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
splitProps (and mergeProps) is a solution to that latter case
17 replies