Hi, a similar issue to Table new page data not loading on click of next button in pagination - #5 by aviator22 except that we don't have any inputs like a search term that change.
What we're trying to accomplish:
- Run a query manually, so that we can avoid running it on pageload
- Server-side pagination still work correctly
This is a graphql (relay flavor) query. Our fairly simple app has 10 queries that display data in tables with server pagination; without the ability to do the above, all of these queries have to run on pageload which slows things down and puts undo load on our database. Thanks
This is stopping us from building in Retool. Every time a user loads an app, all of the queries in the entire app run.
How do we do #1 here? Building performant Retool apps
"Limit queries that run on page load ."
Hi @aviator22 I know we connected over chat, but I wanted to share the workaround with the community as well.
If you have a query that must be triggered automatically, such as a query that returns paginated results, one workaround to avoid triggering this query on page load could be to use a tabbed container. You'd disable the query in the Advanced tab if the selected tab index is not equal to the tab where the query data is needed.
The advanced tab of the query would look similar to this example. Here, I have an automatic query, but it doesn't run on page load--it only runs when I open the second tab (index 1) in my tabbed container:
Does anyone have any other way to accomplish my original question?
The solution Tess mentioned in Aug 2021 no longer works, because Retool is doing the opposite of Please Slow Down, Reduce Breaking Changes
Changes to vars in "disable query" statement now cause queries to fire? - #4 by Kabirdas bug was introduced which, if you used the technique above, is now wreaking havoc on your apps