Skip to content

Result-grid revert without selection disables subsequent edit tracking #2296

Description

@HanawaBanana

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

  1. Open an editable result grid.
  2. Make sure no data cell is selected.
  3. Click Revert.
  4. Edit an existing cell.
  5. 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

  • I reproduced this on Chat2DB Community source.
  • I searched existing issues and pull requests for duplicates.
  • I removed credentials and private data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions