GoogleChromeLabs / airhorn

Air horn
https://airhorner.com/
Other
365 stars 188 forks source link

Double loading of files to be cached #49

Open connetcom opened 5 years ago

connetcom commented 5 years ago

Hi,

Not sure this is a place to ask questions and if not apologies and could you direct me to a more appropriate forum. Thanks.

One general issue (not with this code per-se but related to service worker caching in general) that i see is that some files get loaded twice - specifically those links and scripts which are in the doc head section and then again in the set of files that are to be cached during the service worker install. For example the script is loaded at the end of and is also in the cache.addAll of the install.

So, what seems to happen is that the files that are loaded by the browser because they are linked in the head section get loaded before the install event occurs for the service worker and then get loaded again during the install process to put them in cache.

Am I understanding this correctly and if so, is there a particular strategy to follow to minimize or avoid this?