React-table: Manual Pagination - useAsyncDebounce fn not a function

Created on 19 Dec 2019  路  8Comments  路  Source: tannerlinsley/react-table

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

Most helpful comment

This will be fixed in the next release.

All 8 comments

I'll look into this ASAP. Thanks!

@tannerlinsley i was able to provide a hotfix in this pr https://github.com/tannerlinsley/react-table/pull/1796

There are actually deeper problems with this function beyond what you fixed. I'll be shipping a new useAsyncDebounce function to address both the issues you brought up and the other ones I just found. :)

any updates, @tannerlinsley?

This will be fixed in the next release.

This will be fixed in the next release.

Ah, I probably shoulda been more clear in my question. Was wondering what's the ETA on the next release? Just want to give my team notice as to around when to expect a fix. Thanks for your hard work!

I am running into the same problem.

Thank you for submitting the report @nicholaai and working on a new release @tannerlinsley.

I will wait for the new release before using useAsyncDebounce

Fixed in master, slated for release. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dwjft picture dwjft  路  3Comments

krishna-shenll picture krishna-shenll  路  3Comments

bdkersey picture bdkersey  路  3Comments

mellis481 picture mellis481  路  3Comments

pasichnyk picture pasichnyk  路  3Comments