Closed dy closed 1 year ago
I actually am having this issue in chrome but not firefox. Believe the issue is with how the browser handles changes in the media / rel / etc. attributes on the element. In this case, whenever the value of media is changed the css assets is re-downloaded, i.e. on the initial set to media="only x" then again when media="all". You can test this yourself by flipping the media attribute with a button manually and see in the network tab that the asset will be re-downloaded. I only noticed this happening recently in chrome and again this does not occur in firefox which leads me to believe it's a browser behavior issue.
Can confirm this happens in Chrome 90 too. (tried with both "only x" and "print" as pre-load media type)
Had the same issue, same file was downloaded 3 times. Turned out that in Chrome dev tools I had the "Disable Cache" checkbox checked. After I unchecked it and reloaded the page the file was downloaded only once.
Due to this condition, CSS is loaded twice in Safari. There should come
else
before this statement. https://github.com/filamentgroup/loadCSS/blob/c14df53ebed55d4d06490d19bbc0265e2af19b98/src/loadCSS.js#L77