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
Conversation
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
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 inmain.tsbefore the app boots, callsregistration.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 (sessionStorageflag against a loop). The decision sits in the pureshouldAutoReload(), covered by three tests.⟳ Neu laden/⟳ Reloadvia i18n, largest control in the top bar (min-height: 52px, cyan accent)..menu-top-leftwraps so the longer label cannot overflow narrow phones.hardReload()— the button's cache-clear moved out ofui.ts, which now only wires the click.Verification
pnpm testgreen (264 passed, 1 skipped),pnpm buildclean. 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