- My goal: Refresh Table on another page
- Issue: documentation says to refresh a table on another page, just trigger that table's underlying query
- Steps I've taken to troubleshoot: added a query.trigger() to the success event of query on the main table (also tried using a script for the button click even on the main table)
This seems like it should be a pretty simple built in feature but for the life of me I cannot get it to work.
BACKGROUND : 1 page has a list of buses where one employee outside selects the location and then clicks a dispatch button to let the inside staff know its arrived. A 2nd page shows buses that have been dispatched and are ready for dismissal. When the dispatch button is clicked, it sets a flag and the other table on the 2nd page is filtered to view buses with that flag set. The data works and the table works but I cant get it to refresh automatically which is crucial.
1 Like
Hey @Keith_Lowry and welcome to the comunity.
This sounds a lot like you might be having some type of scoping issue. Retool can't 'auto refresh' a table on a different page if both actions are scoped locally.
Do you mind sending a couple screenshots of your set u to see where things might be going wrong?
The queries in question are global. Beyond that if two people are looking at the exact same table on the same page, if the first user updates something, their table is refreshed, but the 2nd user's is not despite have a refresh table on the Success event of the update query.
Got it -
Is my interpretation of your issue correct?
You have two users logged into the same app on two separate devices. One user makes a change to a table and you run a query. The query on success refreshes the get query that powers the table.
You are confused on why this doesn't update the second user's table on their device /looking for a way to automatically 'refresh' their data?
Sorry just want to make sure I answer the right question here 
1 Like
Correct. Other platforms I have worked on such as Coda, Bubble, Appsmith, just "do it". Data under a table changes, and the table refreshes across devices, users, and instances natively - no triggers needed, no refreshes no code - jut does it. I can't seem to get Retool to that, but I am fairly certainly that it can, or should be able to. I can understand a possible scoping issue across pages, but I dont understand two people looking at the same table and it refreshes only for the user that made the change especially when a query.trigger was called on the success event for that table/query.
1 Like
You can use Hash Parameters with your apps URL. So when you navigate to the app with your table you would use something like your-retool-domain.retool.com/apps/app-id/page2#refresh-table=true
then on page load you can check url.hashParams.refresh-table
in a JS query
note: don't forget you may need to enable Persist URL parameters
:
I think he's talking more about the other person's application refreshing automatically when someone has edited a row inside of postgres, I don't think there is an easy way to accomplish this in Retool currently.
@TobiasOhlsson - have any thoughts here?
ah, my bad, I think you'll have to use polling and query a table that holds either a last_modified date or a has_update column
Retool apps are client-driven — the client needs to trigger queries, so it’s not possible to push updates from the server directly without the client requesting them.
As @bobthebear mentioned, the standard way to handle this is with polling. You can set your query to run every few seconds to keep the table data fresh.
If your query is expensive and you don’t want to refresh it constantly, one workaround is to create a lightweight “update events” table that tracks when changes happen. You can poll that table instead, and only re-run your main query when a new update is detected.
Some users have also reported success using WebSockets within Retool (via custom components or scripts), though that’s not something I’ve implemented personally.
1 Like
Hello @JoeyKarczewski, welcome to the Retool Community!
I understand the issue you’re facing — where two users are logged into the same app and you want a way to synchronize or fetch updated data across users. In this case, you can set up a query to run periodically, which effectively simulates real-time updates similar to using a socket connection.
To implement this, follow these steps:
- Go to your query settings.
- Navigate to Advanced.
- Enable the Run this query periodically option.
- Specify the desired time interval at which the query should execute.
Here is a screenshot for reference:
This approach allows the query to refresh at regular intervals and keeps the data updated for all users without the need for more complex socket configurations.
Note: Depending on the interval you choose, this may increase the number of requests to your backend, so it’s good to find a balance between real-time updates and performance.
I hope this solution resolves the issue you're experiencing. Feel free to reach out if you need further clarification or additional guidance!
I forgot about websockets good call, I've gotten it to work using both the old and new custom component/library but ya you'll need to be a little code savvy to do it so it could be overkill. Do you, or anyone lol, know if creating a View/Virtual Table in postgresql would help if it was an expensive call? I kinda feel like that's what they're for, but not sure if its meant to be used with frequent requests/polling strategy
1 Like