feat(client): offer the new version when a release lands during a session

A tab kept open across a deploy ran the previous build until its next
start. The server now names its version in the realtime welcome frame,
which every open client reads again when it reconnects after the
restart a deploy brings. When that version is not the build the page
runs, a notice offers to reload. The reload goes through the same
service worker handover a launch uses: it waits for the new worker to
take over, or for a short timeout, and records the version only when
the takeover happened.

The notice reads the error boundary's texts for the same situation, so
every language has it already. It is one component for both shells,
sits above the offline pill, stays away offline and after a reload for
that version that did not bring it, and can be closed for the session.
This commit is contained in:
Maurice
2026-10-07 22:40:12 +00:00
parent ba70ad28b8
commit a094f79efa
11 changed files with 421 additions and 9 deletions
+3
View File
@@ -1,5 +1,7 @@
// Singleton WebSocket manager for real-time collaboration
import { useServerVersionStore } from '../store/serverVersionStore'
type WebSocketListener = (event: Record<string, unknown>) => void
type RefetchCallback = (tripId: string) => void
@@ -81,6 +83,7 @@ function handleMessage(event: MessageEvent): void {
const parsed = JSON.parse(event.data)
if (parsed.type === 'welcome') {
mySocketId = parsed.socketId
useServerVersionStore.getState().note(parsed.version)
return
}
listeners.forEach(fn => {