-
Notifications
You must be signed in to change notification settings - Fork 29k
Fetch current service worker version/hash #45414
Copy link
Copy link
Closed as not planned
Labels
area: service-workerIssues related to the @angular/service-worker packageIssues related to the @angular/service-worker packagefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).An issue that is suitable for a community contributor (based on its complexity/scope).workaround2: non-obvious
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
area: service-workerIssues related to the @angular/service-worker packageIssues related to the @angular/service-worker packagefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).An issue that is suitable for a community contributor (based on its complexity/scope).workaround2: non-obvious
Which @angular/* package(s) are relevant/related to the feature request?
service-worker
Description
As you know debugging service worker in production can be a pain. Something that has made it easier for me is to display the hash version in the settings menu of my applications, it provides a way to view "version numbers" of deployed service workers and then I can prepare a safety-worker.js for the correct version.
So when I get a user who reports to me they are having issues, I ask them to go to settings and send me the version number there. Before I started using this method it was a pain to explain to users that they must clear cache or unregister.
Last I checked, the hash is only really emitted when update events are fired (and it is not type safe).
I would like an easier/official way of accessing the service workers hash/version to make it easier to debug and identify what version of deployed service worker is giving issues in deployed apps.
Proposed solution
A new method to get/expose the hash/version
e.g. this.swUpdate.getHash() or this.swUpdate.getCurrentVersion();
it would also be nice to perhaps have this.swUpdate.getPreviousHash();
Alternatives considered
Continue using a workaround for this value, perhaps add workaround to documentation.
Here is code I have written