Skip to content
This repository was archived by the owner on Oct 13, 2022. It is now read-only.

[Offline] Ignoring query string in static files #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ self.addEventListener('fetch', event => {

// always serve static files and bundler-generated assets from cache
if (url.host === self.location.host && cached.has(url.pathname)) {
event.respondWith(caches.match(event.request));
event.respondWith(
caches.match(event.request, {
/**
* Ignoring query string, for example ignore `?foo=bar` in `/logo.svg?foo=bar`
* Read more about cache.match options: http://bit.ly/2Is35VP
*/
'ignoreSearch': true,
})
);
return;
}

Expand Down