Environment
- Chat2DB Edition: Chat2DB Community
- Version: source commit
83bd7c1401bdc461fd2e83de0a250266e46c3286
- Deployment: Web source
- Operating System: macOS 26.5.1
- Database and Version: Not database-specific
Problem Summary
Clicking Revert while the editable result grid has no selected cells permanently disables cell-change tracking for that result-grid hook instance. Later edits remain visible in the grid but are omitted from pending operations.
Steps to Reproduce
- Open an editable result grid.
- Make sure no data cell is selected.
- Click Revert.
- Edit an existing cell.
- Inspect the pending operations or the Preview SQL and Submit controls.
The same sequence is reproduced deterministically by a hook-level test: call handleRevocation() while getSelectedCellInfos() returns an empty array, then call handleCellValueChange() for an existing row.
Expected Behavior
Revert with no selection should be a no-op. A later edit should still be recorded as an UPDATE operation and enable the pending-change actions.
Actual Behavior
The later edit is not recorded. getOperationChangeDetail() returns an empty array.
Root Cause
handleRevocation() sets isListenCellValueChange.current to false before checking the selection. The empty-selection early return bypasses the later reset to true, and handleCellValueChange() subsequently ignores every edit while that flag remains false.
Source:
|
const handleRevocation = useCallback(() => { |
|
if (!tableInstance) return; |
|
// does not monitor cell value changes when undoing operations |
|
isListenCellValueChange.current = false; |
|
const cells = tableInstance.getSelectedCellInfos() || []; |
|
if (cells.length === 0) return; |
|
const _createRowRecordList = createRowRecordListRef.current; |
Evidence
The regression test fails on the source commit above with:
Expected one UPDATE operation, received []
After moving the listener pause below the empty-selection guard, the same test passes.
Impact and Workaround
- Impact: Degrades the editable result-grid workflow and can omit later edits from a submitted batch.
- Workaround: Refresh or reopen the result grid before editing.
Submission Checklist
Environment
83bd7c1401bdc461fd2e83de0a250266e46c3286Problem Summary
Clicking Revert while the editable result grid has no selected cells permanently disables cell-change tracking for that result-grid hook instance. Later edits remain visible in the grid but are omitted from pending operations.
Steps to Reproduce
The same sequence is reproduced deterministically by a hook-level test: call
handleRevocation()whilegetSelectedCellInfos()returns an empty array, then callhandleCellValueChange()for an existing row.Expected Behavior
Revert with no selection should be a no-op. A later edit should still be recorded as an
UPDATEoperation and enable the pending-change actions.Actual Behavior
The later edit is not recorded.
getOperationChangeDetail()returns an empty array.Root Cause
handleRevocation()setsisListenCellValueChange.currenttofalsebefore checking the selection. The empty-selection early return bypasses the later reset totrue, andhandleCellValueChange()subsequently ignores every edit while that flag remains false.Source:
Chat2DB/chat2db-community-client/src/blocks/SearchResult/components/ResultSetTable/hooks/useOperationRecord.tsx
Lines 158 to 164 in 83bd7c1
Evidence
The regression test fails on the source commit above with:
After moving the listener pause below the empty-selection guard, the same test passes.
Impact and Workaround
Submission Checklist