Skip to content

Stop grid cells remounting on every click so double-click can edit #841

Closed

Description

@EVWorth

Severity: P1 (blocks inline editing with the mouse).

What happens

On http://localhost:1420/?mock=connected:

  1. Run SELECT * FROM products and click Edit Mode.
  2. Double-click any cell (e.g. name in row 1). No input appears. Clicking a cell and pressing Enter does nothing either.
  3. A synthetic dblclick event dispatched straight onto the cell's inner element does open the input, so the edit handler works. The problem is that the cell's DOM node is replaced between the two clicks. The node holding the cell content before a single click is no longer in the document after it.
  4. Outside Edit Mode, double-clicking a long TEXT cell (e.g. description) does not open the cell viewer either, for the same reason. Only the hover "View full content" button opens it.

Cause

  • src/hooks/useGridEditing.ts:311 returns a new object on every render.
  • That object is a dependency of the columns memo in src/hooks/useGridColumns.tsx:120, so every render builds new inline cell renderers.
  • flexRender treats each new function as a new component type, so React unmounts and remounts every cell.
  • The first click of a double-click selects the row (clickRow changes state), which triggers a re-render. The second click lands on a freshly mounted element, and the browser never fires dblclick.

Fix

Memoise the return value of useGridEditing (or make useGridColumns depend only on its stable callbacks and the values it reads). Render cells through a stable component that gets the editing state from props or context instead of a closure. Add a test that a cell's DOM node survives a row click.

Part of #783.

Activity

  1. added
    bug
    on Oct 21, 2026
  2. added a commit that references this issue on Oct 23, 2026
    48a811b
  3. added a commit that references this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions