feature request - debounce asyncComputed
See original GitHub issueIt would be nice to be able to define a computed function which waits for 0 or more milliseconds before issuing the compute request, and provides various options for what happens if subsequent requests arrive during that delay.
I’m using asyncComputed
currently with fetch
, but I want to throttle the number of fetch requests being made, and show a “working…” temporary output or something.
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to debounce async validator in Angular 4 with RxJS ...
Here, I'm converting existing observable to promise using toPromise() operator of RxJS. Factory function is used because we need a separate ...
Read more >ng5-async-debounce - npm Package Health Analysis - Snyk
The npm package ng5-async-debounce was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was ...
Read more >How to create a real-time search using debounce in react.js
This article shows how to create a real-time search functionality using debouncing in your react app where the search results update in ...
Read more >Testing Components - Ember Guides
Imagine you have a typeahead component that uses Ember.run.debounce to limit requests to the server, and you want to verify that results are...
Read more >Improve performance for Vue InstantSearch - Algolia
Debouncing is a way to limit the number of requests and avoid processing non-necessary ones by avoiding sending requests before a timeout.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That does indeed sound like a useful thing to be able to do.
I don’t think you need any particular help from this plugin to do it though. Already, you can write something like this, using any promise-based debounce, for instance as provided by the
debounce-promise
package:Debouncing the function passed to
vue-async-computed
does not require any particular changes to the plugin.On the other hand, I don’t know off the top of my head of a simple way to do what you want with regards to showing the placeholder value while the debouncing is going on. It is true that it seems like that could be a useful feature. That said, it’s more a feature for a debouncing library than for this plugin directly. It’s more of a generic debouncing feature than anything specifically to do with Vue.
That said, I’m not against adding that sort of thing if it would simplify matters, although perhaps I’d add it in a separate library as most users of
vue-async-computed
won’t need it and it would be a shame to bulkvue-async-computed
up with things not directly related to Vue.I think the
debounce
d function is failing to react because Vue cannot “hear” the the accessors to my other computed values from inside the debounce function wrapper. If I create thedebounce
d function outside the Vue instance, and pass any computed values into the wrapper, it works: