utils.openUrl doesn't reload page if only query string has changed?

Hi, what we’re trying to accomplish is:

  1. A user is on myapp.retool.com/apps/Myfolder/Myapp?userid=4
  2. They change a dropdown (select) element, which fires js and changes the query string userid field to 5
  3. Page reloads

When the (select) changes we are currently running this js; this does successfully change the url, but the page does not reload:

utils.openUrl('myapp.retool.com/apps/Myfolder/Myapp?userid=5', false);

We need the page to fully reload, so that the queries for userid 5 run. Any thoughts? Normal location.reload functions seem to be sandboxed and do not work. Thanks!

@aviator22 why not just trigger the queries you need directly when you run that JS query?

Because code simplicity and modularity is currently more important to us than building a fully react-ive app

I’ll give more context, as I can’t seem to convince the Retool team that rerunning queries is not always the best idea.

Imagine we create an app with a tabbed container, that has 7 tabs. On pageload, a query runs to get the data that’ll be displayed in the first tab…but not the queries that will populate the other 6 tabs. Only if/when a user clicks on one of those other 6 tabs will its query be run, and data gotten. Why? This will dramatically speed up pageload time/reduce api calls, by not making all 7 queries run on pageload.

Additionally, once that query is run one time, we will not run it again. This way the user can click to another tab, then click back to the previous tab, and we won’t have to rerun the query. It was already run, data already gotten, so the tab will load instantly. Thus we are implementing “get the data the first time the tab is clicked on, but not any times after that” This makes the app snappy, quick, breezy to use.

This is quite simple logic…unless we do what your team is suggesting (rerunning all of the queries every time url query string param changes)

Additionally, imagine we add in modals that implement similar “get data only if interacted with” logic. And some forms. And a workflow or two. And store some of this data in localstorage.

Now “just rerun all the queries” has become an unholy, unmaintainable impossibility. Even if one builds an app less complicated than I describe, “rerunning all of the queries” means additional code that is not always easily maintainable.

Simply whitelisting location.reload would allow us to solve this.

@aviator22 sorry if I misunderstood, your original post seemed to say that you wanted to re-run all your queries by reloading. We are def aware of how running queries on page load can slow down apps, and recommend against it here.

@alex-w mentioned that you were able to chat about this offline, too. I’m adding it into the backlog to work on whitelisting that function :slight_smile: