Flip to the right page with a server-side pagination table

Hi,

I have a server-side pagination table. The table should automatically load to the correct page when the user is redirected from another application. And the correct page number is stored in the redirection URL (#Page=1&ID=12345).
I composed two queries to set up the table pagination and one JS to flip to the right page. The JS will run if Query1 is successful. The approach is suggested in this post.

The actual result is when the user redirects to the table, it seems to flip to the right page, but it somehow causes Query1 to keep re-running. It shows the "All queries completed" message and then "Running query Qeury1" in an infinite loop. And I can't really check if it is the right page because the application keeps reloading data.

Thank you for the help in advance.

Query1

select * from data
where id = {{id.value}}
order by id
limit {{ table1.pageSize }}
offset {{ table1.paginationOffset }}

Query2

select count(*) from data
where id = {{id.value}}

JS

table1.selectPage(urlparams.hash.page)

Hello!

Thank you for writing in. :smile:

What triggers Query1? I'm wondering if we used the watched inputs it could potentially keep it from being triggered repeatedly:

Sometimes when components are selected or modified, they trigger queries associated with them. We'll start with this and go from there!

John

Hi @jSims,

Thank you for the quick reply!
Query1 is set to be "run automatically when inputs change". The inputs are passed by the redirection URL, including ID, Page, and other URL parameters. The weird thing is even when the application is in edit mode and with no URL parameters passed in, it still shows the query is triggered repeatedly.

I didn't set up any watched inputs for this query.

Thank you! Right, so I'm wondering if we gave it some watched inputs if it would keep it from triggering indefinitely. How are you using this query? An example would be, "attached to a table in a tabbed container" or something like that.

Hi @jSims,

The query output is displayed in table1. Not sure if this answers the question of the usage of the query.
I tried to add watched inputs but nothing changed.

Hello again!

Could you share any errors in your browser console when you see the query running over and over again?

Also, this might be a situation where we need to step into your app. Would you be willing to start a conversation in chat (bottom right of your app) so that, with your permission, we could look at the app first hand?

Thank you!