- Issue created by @Grevil
- 🇩🇪Germany Grevil
Basically, "notExcludedPath" always returns true:
Console output:
Most of these are asset urls, where I do understand, that they are not excluded, since they do not point to the node url but rather "/core/...". But the page itself is obviously cached itself.
Furthermore, most code inside the "fetch" method seems to only target assets. Should we instead exclude these urls on service worker "install"?
- 🇩🇪Germany Anybody Porta Westfalica
Indeed, this is an issue!
- The assets from blacklisted URLs should not be handled at all (not even be crawled)
- The admin pages should not be crawled with this default pattern present
Let's try to find out why and how... and how to fix it! Perhaps there are service worker / fetch best practices we can use... and eventually a regex issue on the other hand.
- 🇩🇪Germany Grevil
Inside the PWAController's "fetchOfflinePageResources()" method, we should simply return an empty array early, if the current page is on the "exclude" list. That would fix the problem with the assets being cached on excluded urls.
BUT, the page itself is also getting cached and this is usually done inside the "install" call of our service worker script through "addResourcesToCache()", see here. But it looks like, our script is doing it another way.
Meaning, once we fixed the asset caching problem, we still need to find out, how the pages itself are cached. - 🇩🇪Germany Grevil
Here is another good example, on how this could be handled:
https://wordpress.org/support/topic/prefetch-a-list-of-urls/