foolswisdom
foolswisdom
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
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
Spreading props in jsx as fine. The problem is only when destructuring when accepting props to a function
17 replies
SSolidJS
Created by Jakob on 5/29/2024 in #support
tree structure: granular updates and retain open state
Not sure if it'd solve your problem, if it doesn't, I'd need to take a better look
8 replies
SSolidJS
Created by Jakob on 5/29/2024 in #support
tree structure: granular updates and retain open state
And then index
8 replies
SSolidJS
Created by Jakob on 5/29/2024 in #support
tree structure: granular updates and retain open state
Better to use object.keys
8 replies
SSolidJS
Created by Jakob on 5/29/2024 in #support
tree structure: granular updates and retain open state
Also, probably not related to your problem, but using if/else branching in js (rather than in jsx) means that you won't see updates unless the function callback runs again (which is not how it is meant to work by design)
8 replies
SSolidJS
Created by Jakob on 5/29/2024 in #support
tree structure: granular updates and retain open state
A potential problem is that For operates using reference equality, but object.entries will produce a new array of (new) key/value pairs (as two element arrays), so you won't keep reference equality
8 replies
SSolidJS
Created by ARSON on 5/6/2024 in #support
porting over some ssr react code, getting different behavior
👍
8 replies
SSolidJS
Created by ARSON on 5/6/2024 in #support
porting over some ssr react code, getting different behavior
Try
<Show when={isFormControl()}>
<Show when={isFormControl()}>
Your current code is checking the truthiness of the isFormControl variable, not the truthiness of the result of the function. BTW (this doesn't quite matter in your code, but) although it looks like passing isFormControl() is passing a static value rather than a reactive value, solid's jsx transform wraps and lazifies the call (this is true only in jsx), so when the Show component internally accesses props.when it's actually calling the function (which subscribes to the value of Foo). This is how you normally pass props to components in solid
8 replies