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
Select a framework: preact (bug is not related to preact)
Select a strategy: injectManifest
Select a behavior: Prompt for update
Enable periodic SW updates? yes
Unregister SW? no
Open https://localhost in Chrome in incognito mode
In prompt App ready to work offline: click Close
Wait for 1 minute as suggested in docs
Add console.log('foobar') to examples/preact-router/src/main.tsx`
Repeat step 2 and 3.
In prompt New content available, click on reload button to update. click Reload
Problem: Page does not reload
This happens only for first service worker update. For any subsequent updates, clicking on Reload reloads the page.
Reproduction should be run in incognito mode to simulate first update
Seems that the controlling event doesn't fire in this case:
The issue is related to checks for event.isUpdate, which is false for for first service worker update.
The event.isUpdate property doesn't indicate that service worker has been updated, but the fact that it's an update to service worker that was available when workbox-window was registered.
It's set at workbox-window registration, and not updated later on:
// Set this flag to true if any service worker was controlling the page// at registration time.this._isUpdate=Boolean(navigator.serviceWorker.controller);
Steps to reproduce in v0.21.0:
git clone https://github.com/vite-pwa/vite-plugin-pwa.git
https://localhost
in Chrome in incognito modeconsole.log('foobar') to
examples/preact-router/src/main.tsx`This happens only for first service worker update. For any subsequent updates, clicking on Reload reloads the page.
Reproduction should be run in incognito mode to simulate first update
Seems that the
controlling
event doesn't fire in this case:vite-plugin-pwa/src/client/build/register.ts
Lines 85 to 88 in 95142eb
When I add
Then the
controlling
event fires, however with incorrectevent.isUpdate = false
and in effect reload still doesn't happenBTW: I've noticed that in Workbox Docs > Use cases and recipes > Handling service worker updates with immediacy there is no check for the
event.isUpdate
Possibly related: #256
The text was updated successfully, but these errors were encountered: