Closed stefems closed 5 years ago
hi
I've added a "troubleshooting" section. Your error is the most common users usually make with debouncing, because the function is "stateful" (whether it's with callback or promises). I've wrote an answer on SO about this: https://stackoverflow.com/a/28046731/82609
Smarter users than me probably didn't have this issue but if you declare your search and debouncer functions inside the handler, like in the code below, the debouncer will still fire the async request for every text change. (I think the reason is because the declaration of the functions in that scope means that the references are different on each change, meaning that the async requests aren't cancelled and are still called? Your wording might be better...) Perhaps not a necessary suggestion but it might help people in the future. Thanks.