Skip to content

Update button in the rail when a new version is ready - #73

Merged
caioricciuti merged 1 commit into
mainfrom
feat/update-button
Oct 3, 2026
Merged

caioricciuti merged 1 commit into
mainfrom
feat/update-button

Conversation

@caioricciuti

Copy link
Copy Markdown
Owner

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.

@caioricciuti
caioricciuti merged commit 83d752a into main Oct 3, 2026
5 of 6 checks passed
@caioricciuti
caioricciuti deleted the feat/update-button branch October 3, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant