Is there a way to force End-users to Refresh after a Published update?

We Publish app updates in order to provide new features, but also to fix bugs. Sometimes this requires a change in data structures or formats, in the database, which is shared among all versions of an app. In some cases, this can break old versions.

Including the stale, outdated version still running in a user’s browser for six months straight…

Anvil’s IDE deals with this kind of situation, so I know a solution has been worked out. Any recommended practices and/or techniques that apply, for forcing a user to Refresh his local copy of the app?

I was thinking of a version-check function, on a timer, checking some database entry (since all versions see the same database table rows)…

Since Anvil uses Git underneath, then perhaps there’s a Git-provided version identifier that’s accessible to the app?

2 Likes

Was hoping to see an answer to p.colbert’s questions :frowning:

Here are my thoughts to date.

Note that Anvil doesn’t force a reload; instead, it implements two behaviors:

  1. notifies the end-user to refresh the app (Anvil’s IDE), and
  2. the app refuses to do anything further until they do.

The question then is, how can we do the same?

Probably the simplest way is with version numbers. Embed a version number in the app, and a separate copy in the database. Just before you publish, remember to increment both, and make sure that they’re equal.

That would give an app a way to detect when it needs to do 1. and 2. above. (It can check on startup, or every N minutes, via a timer, or both.)

The rest should be straightforward to build.

That’s the idea, at least. Some time in the next month or two, I should get a chance to try it out.

2 Likes