-
Notifications
You must be signed in to change notification settings - Fork 1k
Service Worker returning old files #7829
Copy link
Copy link
Closed
Labels
Needs: Attention 👋Original poster responded to request for feedback, awaiting attention from Microsoft / community.Original poster responded to request for feedback, awaiting attention from Microsoft / community.area:swService Worker related issuesService Worker related issuestype:archive-old-issueIssues which are closed as tool old for active workIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Metadata
Metadata
Assignees
Labels
Needs: Attention 👋Original poster responded to request for feedback, awaiting attention from Microsoft / community.Original poster responded to request for feedback, awaiting attention from Microsoft / community.area:swService Worker related issuesService Worker related issuestype:archive-old-issueIssues which are closed as tool old for active workIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
not applicable
Developer environment
Windows
What browser(s) / client(s) have you tested
Additional environment details
Describe the bug / error
The ServiceWorker returns old files for files served from SharePoint, e.g.
Style Library, even when using url args for cache busting.When loading a script with
<script src=".../Style Library/script.js"></script>, the ServiceWorker returns random versions (latest or an older version) of that file.On a simple page I'm loading the same file,
config.js, twice. I've added the current Date in ms as url args to get the latest version, but it doesn't work.When I

Clear site data, the ServiceWorker seems to return the correct version. I've seen behavior though, where the ServiceWorker would sometimes still serve old files.The only reliable way of getting the latest files is to disable the service worker under Application > Service Workers > Bypass for network and activating Network > Disable Cache.
I've had many co-workers and customers complain about seeing old file versions.
Steps to reproduce
Expected behavior
The ServiceWorker caches files to long, or doesn't realise it should serve a newer file. Also cache busting to prevent caching doesn't work at all.