AddThisFeature

Edit Conflict Detection

Catch it when someone else saved the record while you were editing it.

involved Collaboration

What it adds

Detects that a record changed underneath an open editor and gives the user a real choice about what to keep.

What your agent is told to do

5
  1. 1

    Give every editable record a version token — a counter or updated-at value — and send it back with the save. Compare it inside the same transaction as the write, not before it.

  2. 2

    When the token does not match, reject the write and show a conflict screen: what the user typed, what is now stored, and which fields actually differ.

  3. 3

    Offer three explicit outcomes — merge the non-overlapping fields, overwrite with the user's version, or discard the user's version and reload.

  4. 4

    Persist the losing draft somewhere the user can get it back before applying any resolution. A conflict must never be the reason work disappears.

  5. 5

    Do NOT build snapshots, diffs of past revisions, or a restore timeline here — that is Version History's job. This feature only handles the collision at the moment of writing.

Edge cases it handles

6
  • Autosave must not throw a modal every few seconds. Detect the conflict once, pause autosave, and hold the draft locally until the user resolves it.
  • Two users editing different fields of the same record should merge cleanly without either being asked anything.
  • A conflict caused by the same user in a second tab still needs resolving — do not skip the check because the author matches.
  • If the record was deleted while the editor was open, that is a conflict too, and 'overwrite' must not resurrect it silently.
  • Comparing serialized JSON or rich text will report conflicts on whitespace and key order. Normalize before you diff.
  • The version token must come from the server. A client-generated timestamp on a machine with a wrong clock defeats the whole mechanism.

Definition of done

8
  • A stale write is rejected by a server-side version check inside the write transaction.
  • The conflict UI shows the user's version, the stored version, and the specific differing fields.
  • Merge, overwrite, and discard are all available and all work.
  • The losing draft is recoverable after any resolution.
  • Non-overlapping edits merge without prompting.
  • Autosave surfaces a conflict once, not repeatedly.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.