We have a mobile app (iOS) that is running as PWA with local data and this data is populated manually by the user.
The issue is that after couple days the app stops calling the server action when the user clicks on the button (manual sync).
I checked the logs and no calls are recorded - today he clicked many times and the last log is from 2 days ago.
Then only after asking the user to clear the cache, the button worked as expected and data was downloaded to local tables.
How can I avoid this long cache on PWA apps? and why sometimes it happens and sometimes doesn't?
It's an iPad and I'm not that familiar with iOS.
Thank you!
Dear @Carolina Bessa , can you check next solutions if one of them fix your issue
Disable Offline Support in OutSystems PWA: If your PWA doesn’t require offline functionality, you can configure your PWA in OutSystems to disable offline caching. This will prevent the service worker from caching data and always fetch fresh data from the server.
To do this:
This will prevent OutSystems from caching the app’s resources locally, forcing the app to retrieve fresh data from the server whenever needed.
Clear Cache on Demand: In OutSystems, you can manually clear the PWA cache via JavaScript. You can create an action in your OutSystems app that invokes a JavaScript block to clear the browser's cache. Use the following code in a JavaScript Block:
caches.keys().then(function(names) { for (let name of names) caches.delete(name); });
Hello Adel, thank you for your reply.
The app needs to work offline as all tables are offline (local tables) - so indeed I can't disable the cache automatically.
Now I see that my question/request makes no sense. :/
hahahaha
I will keep the current process : where the user clears the cache himself via the browser.