Offline editing: local persistence, PWA shell, and reconnect UX #38
Labels
No Label
area:auth
area:docs
area:export
area:ops
area:storage
area:supply-chain
auth
backend
blocked
collab
deployment
docs
effort:L
effort:M
effort:S
frontend
plugins
qa
vs-nfd
vs-nfd:blocker
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: stwaidele/dorfteich#38
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Kickoff decision: continue working without a connection; merge conflict-free on reconnect (ADR 0003).
Scope
Add
y-indexeddbto the editor document hook (local persistence for every opened page),vite-plugin-pwaservice worker caching the app shell, offline UI state (banner + which page versions are local-only), reconnect flow (provider resync merges automatically), and cleanup of local state after successful sync when leaving the page.Acceptance criteria
Technical notes
Dependencies
Depends on #36.
Size: ~2 days
Conventions: English code/comments, clear human-readable code, no hard-coded UI strings (ADR 0012, add
deanden), permission checks only via the shared guard (docs/architecture/permissions.md). Read the referenced ADRs before starting.Verified on Test and Int (commit
7b17e05, pipeline green — all CI + CD jobs, incl. the new offline e2e pack, and Int promotion).Live on Test: the PWA is deployed —
GET /sw.js(200) containsprecacheAndRoute(app-shell precache), aNavigationRoutefallback, and the/api+/collabdenylist;registerSW.jsis referenced fromindex.html. The full offline-reload behaviour is browser-only and is covered by the green CIofflinepack against a real api+collab+web stack.What landed (ADR 0003, realtime-collaboration.md §Offline):
Y.Docto IndexedDB (shared with the collab provider). The local copy is discarded when the page is left after a successful server sync (bounding growth) and kept otherwise so offline edits survive to the next visit./apiand/collabare denylisted and there is no runtime caching, so API responses are never cached or poisoned (the offline e2e asserts an API call fails offline rather than serving a stale 200).onUnsyncedChanges); de + en.Tests:
page-cacheunit test (remember/recall + bounded eviction); theofflinee2e pack — edit, reload while offline (shell from the SW, content from IndexedDB), assert no SW API caching, reconnect, second client converges.CI debugging note (for the record): the offline pack first failed CI-only. The runner log showed the e2e static web server had crashed (
ECONNREFUSED :5173) — its/collabWebSocket proxy didn't handleerroron the client socket, so an abruptly-dropped WS (Linux/Node 22 emitserror; local macOS/Node 26 emittedclose, which is why it passed locally) raised an uncaught exception and took the test server down between packs. Fixed by handling the client-socket error + anuncaughtExceptionguard on that throwaway server.Minor follow-up (non-blocking): the deployed web container serves
manifest.webmanifestasapplication/octet-stream; harmless for the SW, but its mime could be set toapplication/manifest+jsonfor clean PWA installability.