You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @property {boolean|undefined} isUpdate True if a service worker was already
* controlling when this service worker was registered.
However it's name leads to false assumption that it's value is true on any update (even that there was no controlling service worker at the time of registration).
When a new service worker starts installing but an existing version is currently controlling the page, the isUpdate property of all the following events will be true.
Library Affected:
workbox-window
Browser & Platform:
At least Chrome 131.0.6778.86, possibly all browsers
Issue or Feature Request Description:
The
WorkboxLifecycleEvent.isUpdate
will remainfalse
in following scenario:(await navigator.serviceWorker.getRegistration()).update()
This matches the behavior described in source:
workbox/packages/workbox-window/src/Workbox.ts
Lines 698 to 699 in c77dceb
However it's name leads to false assumption that it's value is
true
on any update (even that there was no controlling service worker at the time of registration).Some examples:
chrome for developers > Workbox-window docs > When an updated version of the service worker is found:
web.dev > Broadcast updates to pages with service workers > Listen to service worker lifecycle events
demos > workbox-window
workbox/demos/src/workbox-window/index.html
Lines 53 to 57 in c77dceb
Suggested solution
I think the fix is to set
this._isUpdate = true
after first installation:and adjust jsdoc comments for this property.
I'm just not entirely sure if this is the right place?
Related PR: #1905
The text was updated successfully, but these errors were encountered: