Repository navigation
Offline
Since v0.10.3. The whole site works with no connection: every wedding page and every admin page, honeymoon portal included, opens showing its content and data as they were last saved.
- Install it to the phone's home screen (Safari → Share → Add to Home Screen).
- Open it once with a connection. The installed app saves everything in the background — the app's code, every page, the data each page loads and the photos it shows. It takes a couple of minutes and needs nothing from you. It saves again on its own when the copy is over 12 hours old or the site has been updated.
- The bottom of the admin sidebar says Saved for offline · today 14:02, with Save now to save on demand (that is also how to save from an ordinary browser tab, which otherwise only keeps the pages you visit).
- Offline, a bar at the top says Offline · showing the copy saved ….
- Changes made offline are not saved, and say so: You're offline — this wasn't saved. Try again when you're back online. They are not queued for later, so nothing made on a plane can overwrite a change made since.
- A page that was never saved opens a short page listing every page that is.
- Signing out clears everything saved on that device.
Map tiles, the honeymoon weather and driving-time lookups, and photos that come from booking sites. The pages around them open.
public/sw.js is the site-wide service worker, registered from the app shell on
every page.
| Request | What happens |
|---|---|
| A page | The network, with a 6-second timeout; then the saved copy; then the "not saved yet" page |
The app's code (/_next/static) |
The saved copy first — these files never change once built |
Page data (GET /api/…) |
The network with a timeout, then the saved copy |
| Photos | The network, then the saved copy (saved as viewed, capped at 600) |
| A write | The network; offline, a 503 with the message above |
The background save (src/components/offline/offlineStore.ts) asks
/api/offline/manifest for this build's code files and the page list
(src/lib/offline.ts — admin pages only with a valid session), has the worker
save them, then opens each page once in a hidden frame so the data and photos
each page actually uses are saved. The worker refuses every write from that
frame.
Whether you are offline is decided by asking /api/offline/ping, which the
worker never answers from the cache — the phone's own "online" flag stays on
with a weak or captive signal.
- The app still doesn't open offline — open it once with a connection and wait for Saved for offline in the admin sidebar. iOS keeps a home-screen app's storage separate from Safari's, so saving in Safari does not help the installed app, and iOS may clear the copy if the app goes unused for weeks.
-
Offline needs HTTPS — service workers only run on a secure origin (the
live site through Cloudflare, or
localhost), not on a LAN address likehttp://10.0.0.x. -
Adding a page — put it in
src/lib/offline.ts(check:offlinefails in CI until you do). -
Testing —
npm run check:offline(rules, no browser) andnpm run check:offline:uiagainst a production build. The UI check cuts the server off through a proxy: Playwright's offline switch does not reach a service worker's own requests, so a test that only flips it passes with the network still there.
Setting it up
Using the admin panel
- Guests and RSVPs
- Seating and the Export
- Registry
- Finances
- Honeymoon Portal
- Content and Settings
- Offline
How it works