Reload page without losing cached imgs and other data

Been looking for this one… essentially my app is a single-page app with multiple screens and a lot of images and data being downloaded and cached. Simply realoading using the browser reload button forces the the page re-fetch most of its data, potentially increasing costs and making the experience slower for the end user.

For those looking to reload from cache without re-fetching everything here is a quick tip:

  • Just install the Toolbox plugin
  • Run this Javascript command on an action
location.reload(false);

image

it is actually the same

the boolean parameter is already defaulting to false and makes the page load bypass the cache if true.

Basically location.reload() is the same as location.reload(false) and it will reload the page using the cache if available.

Also it looks like the parameter is not supported cross-browser.

I suppose bubble is already using location.reload() to reload the page, so :man_shrugging:

1 Like

I meant when compared to the browsers reload button, which wipes and re-fetches everything. :wink:

This is usefeul for when you want the user to be able to reload your app (ie reset to the initial state) withouth having to re-fetch everything.

(will edit to make it clearer)

all right, I was more focused on the parameter used :sweat_smile:

anyway

The reload() method of the Location interface reloads the current URL, like the Refresh button.

1 Like