Update button in the rail when a new version is ready - #73
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users needed a hard reload to get a new release. Root cause: the service worker config never emitted skipWaiting and clientsClaim despite autoUpdate mode, so a new worker installed and then waited until every Duck-UI tab was closed; a plain reload kept the old worker and its precached index.html. The app's own reload-on-controllerchange in main.ts never fired for the same reason. Now: skipWaiting and clientsClaim are set explicitly; the app registers the worker itself through the plugin's virtual module (injectRegister off) with onNeedReload, and shows an arrow button at the bottom of the rail once the new worker is in control; clicking it stores pending work and reloads without the leave prompt. Open tabs also check for a new build every hour and when they become visible again. The automatic reload is removed. Existing visitors converge on their next visit: the new worker's own skipWaiting activates it, and their old page's controllerchange handler reloads once. Unit tests for the watcher; a Playwright test simulates a release by changing sw.js on disk, expects the button, clicks it and checks the reload. No new packages: workbox-window was already a dependency of vite-plugin-pwa. Docs: troubleshooting entry.