Skip to content

Debounced autosave with revisioning and conflict handling #288

@goldlabelapps

Description

@goldlabelapps

Create a debounced autosave feature which uses API to save a new revision of the doc with time and uid. On save, the backend detects conflicts and passes that back to client in the responses. Client reacts to the conflict visually and offers 3 solutions before overwriting conflicted; yours, theirs or merge

User Story
As a user editing a document,
I want my changes to autosave in the background,
So my work is preserved without interruptions and conflicts are handled safely.

Description
Implement a debounced autosave mechanism that periodically saves document changes via an API.
Each save creates a new revision containing timestamp and user ID.
The backend performs conflict detection against the latest revision and returns conflict metadata when detected.
The client visually surfaces conflicts and provides clear resolution options before overwriting.

Acceptance Criteria

  1. Autosave behaviour

    • Autosave triggers after user inactivity (debounce, e.g. 1–2s).
    • No save calls while user is actively typing.
    • Autosave is paused during explicit manual save.
  2. Revision creation

    • Each autosave creates a new revision with:

      • revisionId
      • timestamp
      • uid
      • baseRevisionId
  3. API & backend

    • Backend detects conflicts when baseRevisionId is stale.

    • Conflict response includes:

      • latest revision metadata
      • diff or conflicting fields
    • No data is overwritten without explicit client confirmation.

  4. Client conflict handling

    • Conflict state is visually indicated (non-blocking but prominent).

    • User is presented with three explicit options:

      • Keep mine (overwrite)
      • Use theirs (discard local changes)
      • Merge (manual or assisted merge view)
    • Autosave is suspended while conflict is unresolved.

  5. UX

    • Clear status indicators: Saving, Saved, Conflict detected.
    • No silent data loss.
    • Merge option shows side-by-side or inline diff.

Out of Scope

  • Real-time collaborative editing
  • Automatic merge logic beyond simple field-level diffs

Notes

  • Design API responses to be forward-compatible with live collaboration.
  • Conflict UI should be reusable for future multi-user features.

Metadata

Metadata

Labels

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions