Debounce selector

How to make createMemo only refresh max once a second no matter how many signals are inside
const data = createMemo(() => {
// compute heavy stuff multiple signals
})
const data = createMemo(() => {
// compute heavy stuff multiple signals
})
9 Replies
Alex Lohr
Alex Lohrβ€’11mo ago
Solid Primitives
A library of high-quality primitives that extend SolidJS reactivity
Alex Lohr
Alex Lohrβ€’11mo ago
Our community provides a lot of useful packages for occassions like this.
NB 😈 | Nightly 🦊
hey thanks i have already checked it its good for actions but not necessary for selectors
Alex Lohr
Alex Lohrβ€’11mo ago
That's what createScheduled is for. To turn these from effects to memos.
NB 😈 | Nightly 🦊
oh thanks
NB 😈 | Nightly 🦊
btw i am losing types definition because of that
Alex Lohr
Alex Lohrβ€’11mo ago
@thetarnav have we checked the types for scheduled?
thetarnav
thetarnavβ€’11mo ago
Isn’t this because of using p? typescript can’t infer the return type if the parameter has to be inferred as well
NB 😈 | Nightly 🦊
oh bummer thanks for help i managed to solve it