Ladvace
Ladvace
SSolidJS
Created by Ladvace on 8/8/2023 in #support
Reactive var in obj
I have a context provider with an object, one of the property is conditional based on a prop you pass, what is the best way to handle the reactive property in this case?
const query = () =>
condition ? 1 : 2;

const context = {
// ... other properties
query: query(), // The reactive variable 'query' should be used within JSX, a tracked scope (like createEffect), or inside an event handler function.
};

return (
<Wrapper.Provider value={context}>
{props.children}
</Wrapper.Provider>
);
const query = () =>
condition ? 1 : 2;

const context = {
// ... other properties
query: query(), // The reactive variable 'query' should be used within JSX, a tracked scope (like createEffect), or inside an event handler function.
};

return (
<Wrapper.Provider value={context}>
{props.children}
</Wrapper.Provider>
);
5 replies
SSolidJS
Created by Ladvace on 7/1/2023 in #support
regex in useMatch
Is there a way to use a regex in useMatch? I would like to match /book/2 ... but not just /book
5 replies
SSolidJS
Created by Ladvace on 6/13/2023 in #support
remove url params using setSearchParams
is there a way to remove a param from an url using setSearchParams?
1 replies
SSolidJS
Created by Ladvace on 5/9/2023 in #support
Children helper break Context
I made a snippet to better show the problem, I tried looping the props.children instead of using the helper but it didn't really work https://playground.solidjs.com/anonymous/2ad2d60f-5f41-4a3b-abf5-6f9507c6c248
5 replies
SSolidJS
Created by Ladvace on 5/3/2023 in #support
Filtering array in object keyed store inside a produce
In the snippet above I have a keyed object, for each key there is an array, that I filter, the filter doesn't seems working, what is the best way to do it?

setObj(
produce((prev) => {
prev[guy.job] = [
...(prev[guy.job] || []).filter((guys) => guys.id !== guy.id),
guy,
];
return prev;
})
);

setObj(
produce((prev) => {
prev[guy.job] = [
...(prev[guy.job] || []).filter((guys) => guys.id !== guy.id),
guy,
];
return prev;
})
);
I tried also:
setObj(guy.job, (prev) => {
const filteredPrev = (prev || []).filter(
(guys) => guys.id !== guy.id
);
return [...filteredPrev, guy];
});
setObj(guy.job, (prev) => {
const filteredPrev = (prev || []).filter(
(guys) => guys.id !== guy.id
);
return [...filteredPrev, guy];
});
https://playground.solidjs.com/anonymous/eaff2e17-2327-4890-95d8-5c30307672ea
15 replies
SSolidJS
Created by Ladvace on 4/17/2023 in #support
Object.entries not updating
I made a little example of my problem, basically I'm trying to loop with For over a keyed object with object.entries without much success https://playground.solidjs.com/anonymous/935af2d2-30b0-452e-a999-c6edef0e8d52
3 replies
SSolidJS
Created by Ladvace on 3/11/2023 in #support
Property 'pathLength' does not exist on type 'CircleSVGAttributes<SVGCircleElement>'
I was trying setting the pathLength property but I get the TS error above, not sure if the property is missing in the types or what
<circle
cx="50"
cy="50"
r="30"
pathLength="1"
/>
<circle
cx="50"
cy="50"
r="30"
pathLength="1"
/>
4 replies