vik
vik
Explore posts from servers
SSolidJS
Created by vik on 10/11/2023 in #support
How to array.filter Signal with array and pass down as Signal
I solved this for now and understood a bit better reactivity of solidjs with help of thetarnav. Last comment showed what would not work, when option is an array, but not a function or Accessor. This thread shows shows a few approaches I have tried out. Finally I am choosing comobobox prop option to be a function. If I just pass down an array it won't work, because of lazy load feature of solidjs.
16 replies
SSolidJS
Created by vik on 10/11/2023 in #support
How to array.filter Signal with array and pass down as Signal
Actually
function ComboBox({
options,
selected,
setSelected,
}

const optionsMemo = createMemo(() => options);

// consume optionsMemo()
// not working
function ComboBox({
options,
selected,
setSelected,
}

const optionsMemo = createMemo(() => options);

// consume optionsMemo()
// not working
But <ComBoxy options={()=>categories.filter()}> works. (obviously i have to adjust ComboBox and usage of options)
16 replies
SSolidJS
Created by vik on 10/11/2023 in #support
How to array.filter Signal with array and pass down as Signal
I understand. Haven't thought about createMemo inside Combobox. Sure, it would create the reactivity from the options by explicitly observing it.
16 replies
SSolidJS
Created by vik on 10/11/2023 in #support
How to array.filter Signal with array and pass down as Signal
const categoryOptions = createMemo(() =>
data().categories.filter((c) => !c.parent)
);
<ComboBox
options={categoryOptions}
selected={selectedCategory}
setSelected={setSelectedCategory}
placeholder="Select a category"
/>
const categoryOptions = createMemo(() =>
data().categories.filter((c) => !c.parent)
);
<ComboBox
options={categoryOptions}
selected={selectedCategory}
setSelected={setSelectedCategory}
placeholder="Select a category"
/>
16 replies
SSolidJS
Created by vik on 10/11/2023 in #support
How to array.filter Signal with array and pass down as Signal
It works! thanks. Too easy 🙂
16 replies
SSolidJS
Created by vik on 10/11/2023 in #support
How to array.filter Signal with array and pass down as Signal
I know, but then I never really checked if the effect was working and it was probably not crucial for current state of progress. So CombBox is a component, I would like to use it for different option[] kinds. I am not so sure about React anymore, I think would just rerender that complete ComboBox, on filter, so that might have worked in react?! But again I am not sure. Finding my way back to think reactive, think solidjs.
16 replies
SSolidJS
Created by vik on 10/11/2023 in #support
How to array.filter Signal with array and pass down as Signal
Sure! Is that the most elegant way?
16 replies
SSolidJS
Created by eponymous on 10/9/2023 in #support
Is it possible to make two separate SolidJS 'apps' work on the same page?
@Ron W how do use a solidjs component in wordpress? I need to create a wordpress page and my solid app in the page. I thought of creating a wordpress plugin or a page in in child-theme. (wp makes things so much more complicated :/)
13 replies
SSolidJS
Created by vik on 9/8/2023 in #support
Update searchParams with useNavigate
I am not sure if that would be the solution. Hence i have also other query params and the selection of items could be long, i prefer to keep the query string small. Any change triggers browsers attention to jump to the top of the page
3 replies