diff options
| author | Adam Soltys <[email protected]> | 2026-08-03 23:04:41 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-03 23:04:41 -0700 |
| commit | 94c504b650bc13106e93abe4e9c45e840d2ee61e (patch) | |
| tree | a4e0348ca48bc1712b33ad76d9ea0b8bfc486015 /src/format.js | |
| parent | 7b7e93a6086171fec8a710063c86dbe5d4b9841f (diff) | |
| download | coinosv3-94c504b650bc13106e93abe4e9c45e840d2ee61e.tar.gz coinosv3-94c504b650bc13106e93abe4e9c45e840d2ee61e.zip | |
A deploy shouldn't refresh the page out from under you
The app is inlined in the page, so when a new service worker took
control the page reloaded — otherwise it would keep running the old
build. But navigations are network-first: the refresh that triggered
the update had already fetched the new page, so the reload landed a
second or two later as an unasked-for second refresh.
The page and the worker now carry the same build token and the page
asks which build took over, reloading only on a real mismatch. The
token is hashed before substitution, since a page cannot contain a
hash of itself.
tools/sw-reload-test.js pins all three cases against a swappable
server: a first visit doesn't reload itself, a refresh after a deploy
is the only refresh, and a page left sitting open across a deploy is
still reloaded — exactly once. The previous build takes two loads for
one manual refresh; this one takes one.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wvj4aoeMZwA7VUGdJP9Swi
Diffstat (limited to 'src/format.js')
0 files changed, 0 insertions, 0 deletions
