Self-healing for the stale-shell post-deploy paper-cut.
v1.4.38.3 closed the case where a user trips ChunkLoadError mid-navigation — but the reload only fired AFTER the error surfaced. Users sitting on the dashboard or insights overview rode out the staleness until they clicked something. The PWA shell could silently drift across several deploys, surfacing nothing visible until a click happened to lazy-load a missing chunk.
Added
<VersionPoller>client component mounted inside<Providers>. Polls/api/versionevery 60 s. If the live version moves ahead of the shell-baked version it unregisters every active service worker, wipes CacheStorage, and triggerswindow.location.reload().sessionStoragegates the reload to once per session so a mid-deploy webhook race that briefly serves a stale image cannot loop the page.NEXT_PUBLIC_APP_VERSIONis now injected frompackage.jsonat build time (vianext.config.ts) so the running shell knows which release it was built against.
Changed
- Service worker
CACHE_VERSIONnow keys to the release tag (v1.4.38.4). Theactivatestep already evicts any cache name outside the current pair, so bumping the string at release time guarantees the precached root HTML and the precached/_next/static/*chunks from the previous deploy are dropped on the next SW install. The string is now part of the release routine alongside thepackage.jsonbump.
Operator notes
- No new migration. No env-var change.
- Coolify auto-deploys main on tag push.
- Users on the pre-v1.4.38.4 shell still need a single manual refresh to pick up the new poller; from v1.4.38.4 onwards every future release self-heals.