Skip to content

Flight mode: save the lists in the background - #10

Merged
MMMikeM merged 14 commits into
mainfrom
feat/flight-mode
Oct 25, 2026
Merged

MMMikeM merged 14 commits into
mainfrom
feat/flight-mode

Conversation

@MMMikeM

@MMMikeM MMMikeM commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Open the app in flight mode and it shows the lists as fresh as possible: every context that may run in the background now saves them.

What changes

  • Extensions: Chrome's background saves the lists at sign-in, on every push and every 5 minutes. Firefox's saves after its stream opens, after each burst of changes, and every 5 minutes.
  • PWA: the server sends a quiet "Your lists were updated" push for each change, and the worker saves the lists on it and on every other push, plus on Periodic Background Sync where the browser allows it.
  • Grouping: pushes wait one second per person, so a burst (like the edits a phone replays after flight mode) sends once. Each device gets one push: the notifications it hasn't turned off, or else the general one.
  • Rows in the push: each push carries the changed rows when they fit in 4 KB. The worker saves them before fetching, so they're kept if the fetch fails. Only for the account signed in on that device, and never over a newer copy.
  • Settings (PWA): a new page replaces the menu's "Enable background sync". It turns background updates on or off, chooses per device which events notify, and chooses whether pushes wake an idle phone ("Deliver right away", on by default). It also explains when notifications are blocked.
  • Addresses: tasks open at /task/<id>, and /list/<id> switches lists. Notification links point at real addresses, and they open offline through the worker's app-shell fallback.
  • Push sending: a new subscription or a brief failure is retried. A push too large for 4 KB drops its rows, then falls back to a plain one.

Database

db:push in CI adds push_subscriptions.device_id and the new push_preferences table. Both are additive.

Behaviour to know

  • Every notification, reminders included, arrives up to a second later.
  • The overdue summary carries at most 10 tasks plus a total.
  • Chrome extension notifications can't be turned off per device: the extension sends no device id.

Tests

  • New server unit tests (pnpm test, run in CI): what each device is sent, the one-second grouping, and the size fallback.
  • New flight-mode e2e suite (pnpm test:e2e:background, run in CI):
    • with no page open, the Chrome extension and the PWA worker save the lists;
    • a push's rows are saved with the network off, and rows for another account are ignored;
    • a task link opens offline;
    • Settings choices survive a reload;
    • the blocked-notifications dialog appears.
  • New e2e tests for task and list addresses.
  • Not covered: the Firefox add-on's background (Playwright can't load it), the Chrome extension saving rows from a push, and real devices.

@MMMikeM
MMMikeM merged commit b0d984b into main Oct 25, 2026
1 check passed
@MMMikeM
MMMikeM deleted the feat/flight-mode branch October 25, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant