Skip to content

Offline PWA: IndexedDB outbox + background sync #3

Description

@rec3141

Part of #1.

Persist captured samples offline and sync on reconnect, using the already-reserved client_id / local_created_at / sync_version columns on samples.

Scope

  • IndexedDB outbox: each completed sample → a row with client_id = crypto.randomUUID() + local_created_at. Photos stage as Blobs.
  • Background Sync (with an on-load flush fallback) to POST queued sites first, then samples (POST /api/samples), then photos.
  • Idempotent dedup keyed on client_id so a retried POST doesn't double-insert.
  • Surface queue state in the UI (N pending / synced / failed).

Notes

  • sync_log table exists but is currently never written — decide whether sync should populate it.
  • Offline site creation needs a client id too — see the site sub-wizard issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions