We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Prevent caching in PWA when loggedin - OxHybrid | Forum

Paul
Paul May 26 '21
Hi, I bought this awesome app last year and it is really awesome. 
But the caching in the pwa version does not work well.

If a user is login in, he has to reload the page once again to see the console.

If he is loging out, the pwa is showing still the logged version, untill he reloads the page again.


Is it possible to prevent it?

AppXprt
AppXprt May 28 '21
Yea this is actually a problem across multiple PWA's.


I've experienced this even on SuperPWA on WordPress.


Yes it is possible to prevent any page from being cached, but it becomes more of a problem of Chrome working properly. 


To compound the issue there is server side caching, client side caching (browser caching), and PWA Caching.


Another issues is this scenario... You don't include cache control headers, then you want to include them, but your page is cached in browser and PWA. You can't refresh the page until you clear out the old page that included cache control headers. Chrome Developer tools are helpful, but never shows the PWA cached content to be able to clear. There is an option for "Bypass Cache" on network tab, but doesn't work fully.


It is getting better, but there were some things I should have included and then clearing out current cache to include that becomes a complicated issues that has to be done over and over until its perfect.


My newest PWA's use Google Workbox for the Service Worker which is at the root of your website: service_worker.js


There is a section for not caching elements / links which is updated by the do not cache part on the service tab, but its unclear how well workbox handles not Caching.


I'll update all of this as soon as possible.

The Forum post is edited by AppXprt May 28 '21
Paul
Paul May 31 '21
Thanks for you feedback. That sounds good.

Is it possible to deactivate the cache completely, just to use the homescreen or notification function and not to be a 100% PWA?
AppXprt
AppXprt Jun 2 '21
There are different strategies in service workers where you can use a Net Only approach without caching, but this is tricky to get working along with the Install App prompt, because caching used to be a requirement for PWA's. Perhaps it's fixed in the latest Google Workbox  strategies:


Google Workbox Strategies


Another problem is that it's handled slightly different for different browsers like Safari / Firefox / Chrome.

Here are some useful resources:


https://en.wikipedia.org/wiki/Comparison_of_web_browsers

https://caniuse.com/

https://caniuse.com/ciu/comparison

https://caniuse.com/?search=web%20push

The Forum post is edited by AppXprt Jun 2 '21
You do not have permission to reply this topic