Rachit Sharma
Rachit Sharma

Reputation: 43

New Service Worker Update in Production

I am facing an issue regarding service worker update. I have deployed my code on production now we have some changes in service worker, after changes have been done when i deploy on production, i am not getting any changes made on device.

Please help me

On continuation of above problem...

After spending some time on this issue what i have done, i put a version in url of serviceworker in a queryParam e.g. main page- var workerVersion = 'v1' and registered with sw.js?ver=workerVersion.

Now on page load i checked the previous registered version with getRegistration() method if version is different then first unregister the existing worker and install new worker with latest version.

Is there any better way of doing this??

Upvotes: 2

Views: 645

Answers (1)

Rivi
Rivi

Reputation: 791

Have you read this section?
Also, are you using self.skipWaiting() inside the install event? If not it maybe that the new version is waiting until the page is closed.

Upvotes: 0

Related Questions