Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

feat: check for a newer build on start, enlarge the reload button - #9

Merged
dev0zzz merged 1 commit into
mainfrom
feat/auto-update-on-start
Jul 27, 2026
Merged

feat: check for a newer build on start, enlarge the reload button#9
dev0zzz merged 1 commit into
mainfrom
feat/auto-update-on-start

Conversation

@dev0zzz

@dev0zzz dev0zzz commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Why

A tab opened before a deploy keeps running the precached bundle. That is how a stale build writes score records the current leaderboard then filters out — invisible to everyone, including the player who set them. Diagnosing that from the outside is near impossible.

What

  • appupdate.ts (new)watchForUpdate() runs in main.ts before the app boots, calls registration.update() and reloads once when a new worker claims the page. Guards: no reload on a first visit (the worker was installed, not updated), and never twice per session (sessionStorage flag against a loop). The decision sits in the pure shouldAutoReload(), covered by three tests.
  • Reload button — now labelled ⟳ Neu laden / ⟳ Reload via i18n, largest control in the top bar (min-height: 52px, cyan accent). .menu-top-left wraps so the longer label cannot overflow narrow phones.
  • hardReload() — the button's cache-clear moved out of ui.ts, which now only wires the click.

Verification

pnpm test green (264 passed, 1 skipped), pnpm build clean. The service worker is not registered in dev, so the update path itself is covered by the unit test rather than a live run — it exercises for real on the next deploy.

🤖 Generated with Claude Code

https://claude.ai/code/session_014CzfQqjmh4woLTwd4ksaWr

A tab opened before a deploy keeps running the precached bundle, which is
how stale builds end up writing records the current leaderboard filters
out — invisible to everyone, including their author.

On start we now ask the service worker to update and reload once when a
new worker claims the page. Two guards: no reload on a first visit (the
worker was installed, not updated) and never twice per session.

The manual escape hatch stays and is now hard to miss: the reload chip
carries a label, is the largest control in the bar, and its cache-clear
moved to appupdate.ts so ui.ts only wires it up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014CzfQqjmh4woLTwd4ksaWr
@dev0zzz
dev0zzz merged commit 4b2ae0e into main Jul 27, 2026
2 checks passed
@dev0zzz
dev0zzz deleted the feat/auto-update-on-start branch July 27, 2026 10:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant