Snap icon indicating copy to clipboard operation
Snap copied to clipboard

Progressive web app caching interfering with debugging

Open ToonTalk opened this issue 3 years ago • 3 comments

Running Snap! only on localhost it seemed as if it was losing some changes I made today. And yet the source files looked fine. In Chrome's dev tab called "Application" I see it had cached a localhost version of a Snap! PWA. Deleting it fixed my problems. But I worry this will reappear.

PWAs are great but is there a way for them to not cache any localhost files? Perhaps sw.js should use absolute URLs instead of the relative ones it currently lists.

Note I didn't install the PWA. I.e. I did not click on this: image

I don't know how I activated the PWA caching.

ToonTalk avatar Dec 16 '21 15:12 ToonTalk

The caching seems to be on by default. In development you seem to need to hard refresh more. :/ maybe we can add an exception for localhost?

cycomachead avatar Dec 16 '21 15:12 cycomachead

The alternative is to keep incrementing the version number in sw.js

cycomachead avatar Dec 16 '21 15:12 cycomachead

There are extension to block SW registration for selected site (Chrome, Firefox). The simplest one https://chrome.google.com/webstore/detail/block-service-workers/ceokjgeibfjfcboemhdpkdalankbmnej https://github.com/clod81/block_service_workers

DarDoro avatar Dec 17 '21 11:12 DarDoro