Closed arneschuldt closed 4 years ago
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!
and we'll verify it.
ℹ️ Googlers: Go here for more info.
@googlebot I signed it!
This is now in the v0.3.0 release.
Thank you very much!
Problem
Fragment identifiers (the hash part of the URL) are also part of the service worker request URL. This causes problems when using the
sw-appcache-behavior
AppCache polyfill with Single-Page Applications (SPA) because the URL including the fragment identifier does not match the URL cached from the manifest.Related
The same problem had already been identified in https://github.com/GoogleChrome/workbox/issues/488 and https://github.com/GoogleChromeLabs/sw-precache/issues/290.
Solution
This pull request proposes a solution that seems to solve the problem in practical tests.
Tests
The
sw-appcache-behavior
project already contains automated tests. However, they focus on the tricky part of populating the cache correctly from the manifest. There are currently no existing tests that check whether data is correctly retrieved back from the cache by the service worker.Hence, we were not able to simply derive a test for the new behaviour proposed in the pull request.
Hopefully, the pull request can still help improve the
sw-appcache-behavior
.