Skip to main content

Log committed cell edits (debug)

Prop enableEditLog — engine behaviour, default false.

Guide

When to use it

Debugging edits — see every committed cell change in the console without wiring a handler.

How it works

A debug companion to the onCellCommit callback. With enableEditLog on and no handler supplied, every cell commit that writes through — an inline edit saved on Enter / blur, or each cell of a paste — is console.logged as a BstCellEdit (old → new, formatted text, the row).

Gotchas

  • Needs enableEditing.
  • An onCellCommit handler takes precedence and silences the log, so you never get a double signal — for production, wire onCellCommit instead of relying on the log.
  • Deferred row / batch modes still batch through onSave.

Live example

Example source
import React from 'react'
import { BstTableMui } from '@bloomskill/table-mui'
import type { BstTableColumn } from '@bloomskill/table-engine'
import '@bloomskill/table-engine/styles.css'

type Row = { id: string; name: string; team: string; role: string; score: number }
const seed: Row[] = [
{ id: '1', name: 'Ada Lovelace', team: 'Platform', role: 'Engineer', score: 92 },
{ id: '2', name: 'Alan Turing', team: 'Research', role: 'Scientist', score: 88 },
{ id: '3', name: 'Grace Hopper', team: 'Platform', role: 'Engineer', score: 95 },
{ id: '4', name: 'Katherine J.', team: 'Research', role: 'Analyst', score: 90 },
{ id: '5', name: 'Edsger Dijkstra',team: 'Platform', role: 'Architect',score: 84 },
]
const columns: BstTableColumn<Row>[] = [
{ id: 'name', accessorKey: 'name', header: 'Name' },
{ id: 'team', accessorKey: 'team', header: 'Team' },
{ id: 'role', accessorKey: 'role', header: 'Role' },
{ id: 'score', accessorKey: 'score', header: 'Score', sortFn: 'basic' },
]

const editable: BstTableColumn<Row>[] = columns.map((c) =>
c.id === 'name' || c.id === 'score'
? { ...c, meta: { type: c.id === 'score' ? 'number' : 'text', editable: true } }
: c,
)
export default function App() {
const [rows, setRows] = React.useState(seed)
return (
<BstTableMui data={rows} columns={editable} getRowId={(r) => r.id}
enableEditing={{ mode: 'cell' }} onDataChange={setRows} />
)
}
Loading live example…

Overview

Layerenable* (engine, resolved in useBstTable)
Typeboolean
Defaultfalse
Maps tocustom — a debug companion to the onCellCommit(change) callback (itself the inline counterpart to onSave). onCellCommit fires once per committed cell the moment an edit writes through (Enter/blur in 'cell' mode, or per pasted cell) with the single BstCellEdit (rowId · columnId · field · old→new value + formatted text · row); emitted from persist() downstream of commitCell, so it also covers Enter/Tab commit-and-move + paste, while deferred 'row'/'batch' modes still batch through onSave. When enableEditLog is on and no handler is set, each commit is console.logged instead (handler wins — no double signal). In settings ("Editing", always shown; needs enableEditing). Both forward through the adapters (...rest)
Status✅ done
Sincev0.42.0
Settings sheetEditing

Log committed cell edits — a debug aid (the "Both"-mode companion to onCellCommit). When true, every cell commit that writes through — an inline edit saved on Enter/blur, or each cell of a paste — is console.logged as a BstCellEdit (old → new, formatted text, the row). If an onCellCommit handler is supplied it takes precedence and this stays quiet, so you never get a double signal. Needs enableEditing. Default: false (opt-in).

Enable it

<BstTableMui
data={rows}
columns={columns}
enableEditLog
/>

Swap BstTableMui for BstTableShadcn (and the CSS import) for the shadcn skin — same props.

Options

OptionNotes
onCellCommitRelated prop for this feature.

Behavior & interactions

  • Requires enableEditing to be on — this flag is a no-op otherwise.
  • Debug aid: console.logs each committed cell edit (old → new). If you pass an onCellCommit handler it takes precedence and this flag stays quiet — no double signal.