Repository navigation
Commit 6dcb5d4
fix: revalidate pages on every open so the iOS app stops opening old builds (0.12.2) (#325)
* fix: installed iOS app picks up new deploys by itself (0.12.1)
An iOS home-screen app has no reload button and iOS resumes it from memory
instead of reloading, so it kept running an old build while Safari showed
the new one. The service worker file never changes between deploys, so the
existing update toast never fired.
- next.config.js stamps every build with one id (version + time), baked into
client and server (generateBuildId + NEXT_PUBLIC_BUILD_ID).
- GET /api/version (no-store) returns the running build's id.
- PWAToastManager checks it whenever the app comes back to the foreground
(visibilitychange, pageshow from bfcache) and every 5 minutes while open.
On resume with nothing in progress it reloads; with an unsent draft, voice
mode or a call it shows the "new version" toast instead (src/lib/app-update.js).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: pages are revalidated on every open, so the iOS app stops opening old builds (0.12.2)
Next sends prerendered pages with `s-maxage=300, stale-while-revalidate=31535700`.
Browsers ignore s-maxage but honour stale-while-revalidate, so the installed iOS
app kept opening a cached page (and the old build it loads) for up to a year,
refreshing only in the background. 0.12.1's version check never ran because the
old page did not contain it.
src/proxy.js now sends `Cache-Control: no-cache` on page routes (not /api,
/_next or files), so every open revalidates (a cheap 304 when nothing changed).
Hashed /_next/static files stay cached.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 0ac9361 commit 6dcb5d4
3 files changed
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
59 | 70 | | |
60 | 71 | | |
61 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
62 | 78 | | |
63 | 79 | | |
64 | 80 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments