memoized debounce

I want to memoize my debounced function but unfortunately it's not working. Can someone tell whats wrong.
memo(() => debounce(getData?.refetch, 500))
memo(() => debounce(getData?.refetch, 500))
2 Replies
thetarnav
thetarnav2y ago
you could try with this: https://github.com/solidjs-community/solid-primitives/tree/main/packages/scheduled#createscheduled there are two problems 1. sources need to be tracked synchronously before the debounced callback 2. dedounced function produces it's value after the memo fifnished executing, so you need a way to tell it to rerun again to grab the new value
GitHub
solid-primitives/packages/scheduled at main · solidjs-community/sol...
A library of high-quality primitives that extend SolidJS reactivity. - solid-primitives/packages/scheduled at main · solidjs-community/solid-primitives
Abrinzer
AbrinzerOP2y ago
@thetarnav thanks for the input. Is it possible to achieve it without any package ?
Want results from more Discord servers?
Add your server