Allow for query debouncing of onChange handlers

I have a query that reads the value of an input and saves it to my database, that runs onChange. (My example is RadioTree but not sure that matters.) I'd love to be able to debounce the onChange listener, so that I'm not writing multiple values to my database, or possibly creating race conditions where my database doesn't get updated correctly.

This is currently possible by combining local state, setTimeout(), additionalScope, and calling myQuery.trigger() recursively, but it's a HUGE mess and would love to have this supported more broadly.

Thanks!

9 Likes

Upvoted this.

Use case we're dealing with is scanning long barcodes into a text input. The barcode scanner we use basically enters a key at a time in the input which Retool listens to and tries to execute transformers and queries.

Currently scanning one of these barcodes basically brings Retool to a halt as with each keypress, it tries to execute a ton of stuff in the background.

Would be nice to add a debounce/throttle setting to these text inputs to say transformers will only be called until some amount of time elapsed since the last time it was invoked.

For now, we switched the query to be run manually instead of when inputs change

1 Like

upvoted! This would be super useful to avoid multiple queries or have a button to do searches manually

1 Like

bump