bc-grid
GitHub

Per-cell undo / redo

View source

Cmd+Z reverts the most recent commit on the focused row; Cmd+Shift+Z (Mac) or Ctrl+Y (Windows) re-applies it. Per-row scope, capped at 10 entries per row. Built in — no consumer wiring.

Order #
Customer
Sales rep
Status
Amount
R-000001
Customer 00001
Avery Chen
active
$0.00
R-000002
Customer 00002
Ben Singh
pending
$31.42
R-000003
Customer 00003
Cara Diaz
closed
$62.83
R-000004
Customer 00004
Drew Lin
active
$94.25
R-000005
Customer 00005
Elena Park
pending
$125.66
R-000006
Customer 00006
Felix Roy
closed
$157.08
R-000007
Customer 00007
Gita Bose
active
$188.50
R-000008
Customer 00008
Henry Kao
pending
$219.91
R-000009
Customer 00009
Avery Chen
closed
$251.33
R-000010
Customer 00010
Ben Singh
active
$282.74
R-000011
Customer 00011
Cara Diaz
pending
$314.16
R-000012
Customer 00012
Drew Lin
closed
$345.57
R-000013
Customer 00013
Elena Park
active
$376.99
R-000014
Customer 00014
Felix Roy
pending
$408.41
R-000015
Customer 00015
Gita Bose
closed
$439.82

Try this

Watch the [source] tag in the commit log: keyboard / undo / redo.

  • Edit any cell, commit it, then press Cmd+Z — the value reverts and a new commit fires with source: "undo".
  • Press Cmd+Shift+Z to redo.
  • Edit the SAME row 3 times, then undo 3 times. The stack walks backwards through that row only.
  • Edit a different row — the undo stack is per-row, so this row keeps its own history.

Gesture matrix

PlatformUndoRedo
MacCmd+ZCmd+Shift+Z
WindowsCtrl+ZCtrl+Y or Ctrl+Shift+Z

Semantics

  • Per-row scope.Each row maintains its own undo stack. Cmd+Z on row A undoes A's most recent commit, not row B's. Matches Excel / Google Sheets convention.
  • Capped at 10 entries per row. When the cap is reached, the oldest entry shifts out. Bounds memory regardless of how aggressively a single row is edited.
  • Redo stack clears on new commits. Typing a new value invalidates pending redos — the user has chosen a new history branch.
  • No-op while editing.If an editor is currently mounted, Cmd+Z is the input's native undo (in-progress text), not the grid's.

onCellEditCommit gets a source

When the grid restores a value, it fires onCellEditCommit with source: "undo" or source: "redo". Most consumers can treat undo/redo identically to a normal commit. Branch on event.source if you need to skip secondary side-effects (audit log entry, collaborator notification) that the original commit already triggered.