Looking for best practices on app updates - force users to refresh

Hi everyone,

I recently had this issue with users logging into a previous version of the app (Is it possible that a user is working on a previous deployment of the app?). I opened a ticket and WeWeb confirmed that it’s possible if the user didn’t refresh the app after it was published.

Now my question here is - are there any best practices on how to “force” users to refresh after an update? I understand that a “hard” method is not possible, but I wonder if there’s any recommendation as what to do to prevent these cases to happen.

I understand that a “full refresh” is needed, because I’m completely sure that my users went through the login process and still were sent to a previous version of the app (the error described in the previous post only happens after someone logs in, otherwise the workflow is not triggered).

Any recommendations?

I find this critical because I need to make sure that users are on the last version of the app.

Thank you very much in advance.

You could add a field to your user called update_avalible or something and have a popup that shows when your this is true. and then update that on app load/ when the user logs in

That’s indeed a good idea @sam1. I’m thinking about how to better implement it.

My initial thoughts were the following:

  • Create a variable in WeWeb with a fixed value in which I will include the version of the app that is in production.
  • Create a standalone field in Xano that contains the same value.

Since the user is always working with the latest values stored in Xano, no matter if they’re working with the latest version of the app (since we’re making the API calls online), I’d be able to compare if the fixed value in WeWeb equals the value stored for the user. If it’s the same, it means that the user is working in the latest version of the app. If it’s not the same, I could trigger a pop-up with a button to refresh (I guess that button could work with a custom JS).

However, I have the following problem: the JS is not working properly.

I have included this in the button (generated by the assistant):

// Reload the current page using the window.location object
window.location.reload();

// It's CRITICAL to finish your code with a return statement otherwise the script will not be executed.
return;

But the result that I get after it is triggered is a completely blank page :frowning:

Any thoughts?

it could be good to test that in a staging environment, you could also try using the weweb navigate workflow potentially send them to a home page or something that redirects them back

I can confirm that the code that I included in the above message is working fine when published.

The final approach that I’ve taken is to have a variable with a fixed value in WeWeb while having the list of versions that are enabled for the user in Xano, which means something like this:

To display the modal, what I’m doing is checking whether the fixed value that I have in WeWeb is included in this list of enabled values from Xano. By doing this I make sure that there are no issues with users in the moments when the new version is being deployed - otherwise I would need to manually coordinate to the second the moment when the new version is deployed to change the value in Xano on that very moment.

I hope this is useful for someone else!

2 Likes