Feature Library

Undo that says what it undoes

0.19 CPU ms
A still of the Undo that says what it undoes demo
Still
The live demo starts when it’s in view.Drag, recolour, resize, add and delete tiles · rename Dune: Neon’s size formula follows, one step · Ctrl Z / Ctrl Shift Z · click the history to jump

An undo/redo history whose steps carry a few words, so the buttons say “Undo Move ‘Dune’”; one drag or one typing session is one step, and so is a drag of a…

What it costs a frame

0.19 ms
GPU
not used
CPU, median
0.19 ms
CPU, 95th pct
1.06 ms
Draw calls
0
Weight
Light

Measured 3 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 156, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured exercising itself: every frame commits an edit (a move or a recolour) and re-renders the board, the bar and the history; every other frame undoes or redoes, and every 40 frames it jumps back through the history. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring toolnot timed0.191.06
apple · Apple A19 Proin a browser tab · 16 November 2026not timed0.781.80
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed0.422.50

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Editors and design tools
  2. Boards and canvases
  3. Forms with many fields
  4. Settings panels
  5. Level and content editors
  6. Property inspectors with sliders and colour pickers
  7. Renaming a value that formulas read

Pitfalls, in brief

  1. Every edit must make a new object: identity is what undo, redo and “unsaved” are built on, so a value mutated in place cannot be taken back.
  2. Keep selection, hover and scroll out of the stack: undoing a click that only selected something feels broken.
  3. Name a step when it ends, not when it starts: a rename is “Rename ‘Dune’ to ‘Dusk’” only once the typing is done (release(label)).
  4. A merge window joins same-label commits only: give a run of nudges one label, and call stopMerging() where a run should break (a click elsewhere, a save).
  5. Leave Ctrl Z in a text field to the field: its own undo is what the author means there, and the stack records the field as one step when it loses focus.
8 more in brief
  1. A slider fires input for every value it passes, and Chrome fires change for every arrow-key press too: a slider that writes on either is a hundred steps a drag, or one per auto-repeat of a held key. bindField ends a slider’s step on pointer up (caught on the window, wherever the pointer is released), on key up, or on a change with no key or pointer down (a screen reader’s step).
  2. A field that previews through the stack re-renders everything that reads the state on every value.
  3. Chrome doesn’t repaint ::-webkit-slider-runnable-track when a custom property on the input changes, so a fill drawn there from --p lags the thumb.
  4. Rename and rewrite in one commit (or inside one hold): two commits are two undo steps, and undoing only the second leaves formulas that name nothing.
  5. Refuse a new name another value already has (renameWithRefs does, any capitals and spaces): every formula naming it would then read one or the other.
  6. While a rename is typed in a hold, the formulas still name the old one: resolve the old name to the item until the hold ends (the demo does), or rewrite on every keystroke and refuse collisions as you go.
  7. renameNamesIn leaves words in quotes, a card’s name before a dot, a field after one and a function’s name alone: if your formulas have other forms (a sheet’s A1, a {Name} template), rewrite those yourself.
  8. With createHistory, an undo function that records its own change would record the undo: records made while a step is applied are ignored for that reason, so make the change inside the undo function, not in a later tick.
13 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Fully custom code.

undoredohistorygesturesdraftskeyboard shortcutsslidersform controlsrenameformulasreferencesinspectoruseSyncExternalStoreno dependencies

Near it in the frame