Server-side pagination does not load next page

Hi,

I am using the old table component in some apps and it works fine.

However with the new component (self-hosted 1.3.1) , I can't make pagination work: only the first page loads. What am I doing wrong?

REST GET parameters:

Table Pagination setup:

BTW your page at Optimize queries with server-side pagination | Retool Docs mentions a Next cursor field, but that does not exist.

Use the updated table data to specify the values for the Previous cursor, Next cursor, and Has next page fields in Inspect > Pagination. For example, using the Stripe API, Next cursor is the ID of the last customer in the table.

Zzzzzz

My post has been there 2 weeks without a response. Is there still customer support here in the forum?

Hi @Francis, welcome back to the forum! :wave:

I'm sorry you've been waiting on a response. We are doing our best to catch up with the increment of questions here on the forum. :chart_with_upwards_trend:

Thank you for your patience. :slightly_smiling_face:

There are a couple of things I would check for our cursor based server-side pagination to work the way we expect. Before jumping into them, I would appreciate if you can double check your Self-Hosted version, 2.x.x goes as far as five years ago, if you are using v1.3.1, there could be other issues with how our new components are running there. I would be happy to connect you with someone that can help you upgrade (perhaps 1.3.1 is the release version of your app).

Now let's get into what could be causing this issue. :face_with_monocle:

Right off the bat, I see the uppercase .Pagination property we are trying to access from the response of the API. The key may be lowercase -.pagination- but the reason it is highlighted green on our UI, as if there were no errors, is because we are using JS's Optional chaining, which makes it all 'valid' (call if exists) as long as what is left of it evaluates to a truthy value.

We recreated your use case:
A table using cursor based server side pagination that gets data from an API (credits to @Tess), and with a very similar setting, we are having no issues.

To show how the optional chaining may be giving us a false positive on the value of what is right of it, I'll share our "Next cursor" settings:

Note: We added a .split on "Token=" just because of how the response of our API looks like.

Because there is currently a value for {{query1.data.next_page_uri.split('Token=')[1]}} it is showing green. :green_heart:

However, when we go to the last page of our table (no more results from the API :smiling_face_with_tear:), it shows red because the value for that key is now null :


If you could share with us the value of {{decodeURIComponent(SearchBrokerTrades.data)}} we could have a better grasp of what exactly is going on with your pagination. Feel free to hide any private data, we mostly want to see the .Pagination key.

If that is not the case, your resource query may be set up to run when is manually triggered. For the table to update with the new results when we change pages, we need to select "Run query automatically when input changes":


Let us know if you have any questions. We are happy to take a deeper look at what is causing your issue.

Hi Paulo, thanks for following up.

I am using Retool version 3.28.6 (yes: 1.3.1 was the app version, not retool).

It turns out I had a server-side pagination bug where the cursor was not decrypted on this specific endpoint, so it barfed with "invalid cursor".

The Retool control pagination works correctly--I am sorry for wasting your and Tess time (and mine).

Francis

Hey Francis, no worries. You did not waste our time! Your feedback helps us understand our customers' pain points and leads to improvements in our product. We are always happy to help. :slightly_smiling_face:

Happy building! :hammer_and_pick: