Expo.Updates.reload() behavior

Continuing the discussion from Updating with Updates API:

This seems to conflict with what’s in the docs:

Immediately reloads the current experience. This will use your app.json updates configuration to fetch and load the newest available JS supported by the device’s Expo environment. This is useful for triggering an update of your experience if you have published a new version.

Will Expo.Updates.reload() force a reload from the server, even if fallbackToCacheTimeout is set to 0?

Hi @aatreya - sorry for the long delay here. Updates.reload do the same thing as if you were re-launching the app. So, if your updates config in app.json is just { "fallbackToCacheTimeout": 0 }, calling Updates.reload will request a new version, timeout immediately (0 seconds) and load the cached version, and continue to fetch a new version in the background.

You probably want to use Updates.reloadFromCache() instead, which will also immediately load the cached version, but will NOT continue trying to fetch a new version in the background.

Hope that makes sense!

Great - thanks for the clarification. Is there a way to force a reload of the app while explicitly waiting for an update to be available? We’d like to keep the fallbackToCacheTimeout at 0 for the best loading experience, but under certain circumstances we want to be able to ensure that the client is running the latest JS code by forcing a reload.

@aatreya - when you want to ensure the client is running the latest JS code, you could use the Expo.Updates module methods to manually check for an updated version and download it before reloading, so that it’s already in the cache. See this guide for more information: https://docs.expo.io/versions/v27.0.0/guides/configuring-ota-updates#manual-updates

If you’re asking about forcing a reload remotely, e.g. as soon as you publish a new version, we don’t support that functionality at this time unfortunately.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.