Browser caching old version of weweb

Some people had some issues with our app so looking into it with sentry we saw they press the go back button in chrome and then it put them on an older version of our app. It’s clearly visible the difference as we made quite a few noticeable UI changes so you can see before the back button it’s the update to date version then on the navigation it goes to the old version. This version is also not just our last update we’ve had about 3 since the one they ended up on.

Has anyone dealt with this before and what did you do to fix it?

4 Likes

I randomly have this issue on iOS. If my app crashes, I’ll be reverted to a version from a week ago, it’s puzzling…

Yes, I’ve had users experience this. I tend to see it in the Xano endpoint logs. Endpoints no longer used show being triggered.

Would there be a way to check cache version on login and if out of date, force a clear action?

That’s a little scary. Do you think the cached version is originating from your browser or WeWeb?

Pretty sure it’s a browser thing (Safari PWA). Not sure if it’s just standard browser caching, something with the service worker or what… :thinking:

1 Like

I think this is definitely a browser issue. From what we looked into everything pointed it towards being a cached browser version.

I came up with a solution, we added a new table in Supabase called app_version and when we push to production, on our first login on the new published version it sends an insert to the table with the new cached version you can get this by running window.wwg_cacheVersion. Now we just check on page load if the current window.wwg_cacheVersion of the user is the same as the latest in the DB if it isn’t we have a warning and force them to reload the page.

2 Likes

I’m not so sure this can be fixed with a simple page reload. I’m having to instruct users to clear the Safari data for my site in the ios settings page.

Seems like it’s a service worker issue. I pushed an update to my staging environment and see this using dev tools:

Logging out and back in did not update the worker.

Refreshing the browser did not update the worker.

Only closing the tab and opening the staging app again forced the update.

Maybe this is standard behavior, but I need a way to force the update. Anyone have a suggestion?

@ericp

Did you do a hard refresh?

CTRL + 5 for Windows
command + option + r (on mac)

If you do a normal refresh this uses the cached browser version, a hard refresh gets the server version.

From a bit of research though apparently my code doesn’t always work in newer versions of browsers

Doesn’t really matter, as the point is I can’t expect my users to be doing this. They want to login to the app and use it, irrespective of whether in a new tab or one that has been open to the app for weeks.

I played with the ai assistant and chatgpt to try to force and update on page load, but was unsuccessful.

I don’t think this is all a WeWeb issue if any at all, it’s mainly a user/browser issue.

The app shouldn’t be open on a tab for a weeks, that’s definite way for them to be on the old version.

Also you can definitely do this automatically you’d have to follow my brief solution above. Also look into how to force a hard refresh on all types of browsers.