Skip to content

Manual Pagination - useAsyncDebounce fn not a function #1794

@nicholaai

Description

@nicholaai

Using 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

  1. Visit Sandbox
  2. Open chrome console
  3. 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
image

Desktop (please complete the following information):

  • OS: Mac Mojave 10.14.1
  • Browser: Chrome
  • Version: 79.0.3945.79

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions