Skip to content

feat: inline cell editing (v1) with async edit lifecycle#174

Merged
blove merged 13 commits into
mainfrom
claude/cell-editing
Jun 9, 2026
Merged

feat: inline cell editing (v1) with async edit lifecycle#174
blove merged 13 commits into
mainfrom
claude/cell-editing

Conversation

@blove

@blove blove commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Adds inline cell editing — the largest table-stakes gap for a "drop-in React data grid" (from the v1 gap assessment). Built spec → plan → subagent execution with two-stage (spec + quality) review per unit.

Spec: docs/superpowers/specs/2026-06-08-cell-editing-design.md · Plan: docs/superpowers/plans/2026-06-08-cell-editing.md

What it does

  • Controlled, pessimistic data flow: a commit fires onCellEdit({ rowId, columnId, value, row }); the app updates its own rows. No internal row mutation. onCellEdit is a prop on <Pretable> and <PretableSurface>.
  • Full async lifecycle: per-cell editable, validate, and commit may each be Promise-returning. Phases (checking → editing → validating → saving, plus invalid/error) are modeled as sync transitions in @pretable/core (snapshot.editing.status); the React surface drives the async hooks via useCellEditController, guarding stale resolutions with a monotonic token.
  • Column API: editable?: boolean | (input) => boolean | Promise<boolean>, validate?: (value, input) => (true|string) | Promise<…>, renderEditor?, parseEditValue?/formatEditValue?.
  • Editor UX: default text editor + renderEditor escape hatch. Begin: Enter / F2 / double-click / type-to-replace (on editable cells only). Commit: Enter → down, Tab → right. Cancel: Escape. Editor owns keystrokes while active (grid nav/selection correctly suspended).
  • Headless parity: the lifecycle lives in the engine, so custom renderers get editing via snapshot.editing + the beginEdit/commitEditSucceeded/… transitions.
  • Docs: new /docs/grid/editing page + nav entry.

Scope (v1)

In: the full async lifecycle, default + custom editors, parse/format, triggers, pessimistic commit. Out (follow-ups): drag-fill, paste-into-range, multi-cell editing, optimistic commit, undo.

Verification

All gates green locally: package tests (grid-core 84, react 225, +others), repo typecheck / lint / format, api:check (core + react reports regenerated), website build (editing route in the search index). An independent final review cleared it READY TO MERGE; a keyboard-nav-leak bug found mid-review was fixed (67f5ccb).

Known v1 follow-ups (filed separately, non-blocking)

  • Blur-to-commit: clicking another cell mid-edit currently leaves the editor open (recoverable via Enter/Escape). Wiring blur→commit safely needs care around in-flight async saves — tracked as a follow-up.
  • Default editor doesn't surface validate/commit error messages or pending affordance (the data is in snapshot.editing.error/.status + a data-pretable-edit-status hook for consumers; default React UX + ARIA polish is a follow-up).

🤖 Generated with Claude Code

blove and others added 13 commits June 8, 2026 16:19
Controlled onCellEdit data flow; the edit lifecycle (checking → editing →
validating → saving, with invalid/error branches) lives as sync transitions in
@pretable/core (snapshot.editing) while the React surface orchestrates the async
hooks (editable/validate/commit, all Promise-capable). Single-cell scope for v1;
fill/paste/multi-cell/optimistic/undo deferred.
9-task TDD plan: edit-lifecycle types + sync state machine in grid-core
(snapshot.editing); public surface on @pretable/core; async orchestrator
(useCellEditController) with staleness token; default CellEditor + renderEditor;
wire triggers/editor/onCellEdit into PretableSurface; surface through <Pretable>;
docs page; full verification incl. api:check regen.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…EditorInput

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes a no-unused-vars lint error that would fail the required repo-lint
CI gate. The helper was never wired into any test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… render, onCellEdit)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Arrow keys, Home/End, PageUp/Down, and Cmd+A pressed inside the cell
editor input bubbled to the grid's onKeyDown and moved focus/selection
underneath the open editor. CellEditor only stop-propagates
Enter/Tab/Escape. Bail out of the grid keydown handler whenever an edit
is active so the editor owns the keyboard; add a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pretable Ignored Ignored Jun 9, 2026 3:00am

Request Review

@blove blove enabled auto-merge (squash) June 9, 2026 03:01
@blove blove merged commit a3f2abe into main Jun 9, 2026
13 checks passed
@blove blove deleted the claude/cell-editing branch June 9, 2026 03:02
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Vercel preview ready

Preview: https://pretable-2atyphuuy-cacheplane.vercel.app
Commit: 56805d736bb330bc28889314a056dd45ee9ff016

Updated automatically by the deploy-preview job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant