Manual Pagination - useAsyncDebounce fn not a function
See original GitHub issueUsing 7.0.0-rc.15
Describe the bug Originally created a conversation on Spectrum but I believe since this is a bug it might be better suited to be on Github.
I’m running into a bug when trying to use useAsyncDebounce
:
index.es.js:286 Uncaught (in promise) TypeError: fn is not a function
at _callee$ (index.es.js:286)
at tryCatch (runtime.js:45)
at Generator.invoke [as _invoke] (runtime.js:271)
at Generator.prototype.<computed> [as next] (runtime.js:97)
at tryCatch (runtime.js:45)
at invoke (runtime.js:135)
at runtime.js:170
at new Promise (<anonymous>)
at callInvokeWithMethodAndArg (runtime.js:169)
at AsyncIterator.enqueue [as _invoke] (runtime.js:192)
What I’m trying to accomplish:
- Manual pagination that will take can use a search term and filters
- Have a form that takes in a search term / filters.
- When users submit that form, the pageIndex needs to be reset and new data needs to be requested from my API
- When clicking over to the next page, the new data should be requested via api with the latest search term and filters
To Reproduce
For full steps on my exact use case and bug discovery (including my actual code) please visit the spectrum post. Will leave out my full code from the bug here.
I created a Sandbox for a simple recreation. The sandbox uses the pagination controlled example as it’s base and simply adds the useAsyncDebounce
as described here
- Visit Sandbox
- Open chrome console
- You’ll see the error in the chrome console
Expected behavior
I expect to not get an error and have a usable debounced function which will prevent pageIndex
state being reset to 0
twice in order to avoid 2 consecutive data fetches.
Screenshots
Desktop (please complete the following information):
- OS: Mac Mojave 10.14.1
- Browser: Chrome
- Version: 79.0.3945.79
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:8
This will be fixed in the next release.
I’ll look into this ASAP. Thanks!