New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(client): multiple clients with prompt for update #394
Conversation
✅ Deploy Preview for vite-plugin-pwa-legacy ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There is a strange behavior when testing multiple clients restarting the server once sw is rebuilt, depending on the client that fires the first installation and the client used to reload the app, the original that fires the first installation (or last one once refreshed) is showing the ready to work offline prompt, it seems we need to deal with some internal flag. Steps to reproduce (with any fw):
Depending on the fw used, instead the ready to work prompt you can get the reload prompt dialog: for example, vue will show the prompt while solid will show the ready prompt dialog. Maybe it depends on some other state/flag... it is weird |
it seems to be related with the heuristic algorithm used in workbox-window: I'll try to test it awaiting 1 minute between updates |
After digging into the workbox window source code I've fixed the problem: we can also remove all warnings about heuristic algorithm from the docs
EDIT: I'll review all docs entries about heuristic algorithm and remove the component. |
Thank you for the turnaround on this! 😊 |
I have tested this PR using
pnpm run build && pnpm run examples
using vue example with 2 chrome instances, first one with 2 tabs. Once I refresh one app, the reload prompt will be shown on other tab/instance and once reload the app, the 3 clients are updated (the prompt dialog also gone on the 3 clients).EDIT: once installed on the 3 clients, stop the server and run
pnpm run examples
again with the same configuration and refresh the page on 1 client.We need to test it on Firefox and Safari on others OS: only tested on Windows 10 PRO.
/cc @develohpanda
closes #393