Skip to content

fix(result-grid): re-apply create/delete highlights after arrangement reset - #2406

Merged
openai0229 merged 4 commits into
OtterMind:mainfrom
Aias00:fix/operation-record-highlight-sync-2405
Aug 3, 2026
Merged

openai0229 merged 4 commits into
OtterMind:mainfrom
Aias00:fix/operation-record-highlight-sync-2405

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What

The cellChangeRecordList effect clears VTable customCellStyleArrangement to fix update-color cycling, then re-applies only update-cell styles. Because the create/delete effects do not re-run for a plain cell edit, green new-row and red deleted-row mappings disappear even though the operation records still exist.

Fix

After the arrangement reset, re-apply create-row and delete-row ranges as well as update-cell styles. Include createRowRecordList, deleteRowRecordList, and columns in the effect dependencies so every reset uses the current row records and column range. The loops use forEach because they only perform style side effects.

Verification

  • Merged current main, including the latest result-grid recursion regression coverage.
  • Full test:result-operation-record contract passes.
  • Targeted ESLint passes.
  • Existing Node contracts do not mount browser effects; a manual UI check remains appropriate for the actual VTable paint path: keep green/red rows present, edit an ordinary cell, and confirm all highlights remain.

Fixes #2405

🤖 Generated with Claude Code

… reset (OtterMind#2405)

The cellChangeRecordList effect cleared customCellStyleArrangement (all
arrangements, including create/delete) to fix VTable A->B->A update-color
cycling, then re-applied only custom-update-cell. The create/delete
effects only re-run when their own deps change, so a plain cell edit left
green (new-row) / red (deleted-row) arrangements cleared until the next
sort/filter. Re-apply create/delete arrangements in the same effect after
the reset, and add them to the dependency list.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: liuhy <liuhongyu@apache.org>
@Aias00
Aias00 requested a review from openai0229 as a code owner August 3, 2026 06:51
Copilot AI review requested due to automatic review settings August 3, 2026 06:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a UI inconsistency in the result-grid where editing a single cell could clear “new row” (green) and “deleted row” (red) highlights until the next sort/filter, due to a VTable arrangement reset performed to work around an update-color cycling bug.

Changes:

  • Clarifies the inline comment explaining that resetting customCellStyleArrangement clears cell→style mappings (not style definitions).
  • Re-applies create/delete row highlight arrangements immediately after the arrangement reset in the cellChangeRecordList effect.
  • Extends the effect dependency list to include createRowRecordList, deleteRowRecordList, and columns so highlights are restored after resets triggered by plain cell edits.
Suppressed comments (1)

chat2db-community-client/src/blocks/SearchResult/components/ResultSetTable/hooks/useOperationRecord.tsx:462

  • Array.map (and optional chaining on the result) is being used only for side effects; switching to forEach is clearer and avoids allocating an unused array.
    findRowNumbersByIds(tableInstance, deleteRowRecordList)?.map((row) => {
      tableInstance?.arrangeCustomCellStyle(
        { range: { start: { row, col: 0 }, end: { row, col: columns.length } } },
        'custom-delete-cell',
      );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@openai0229 openai0229 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed after syncing with current main. Reapplying create/delete arrangements in the same effect is consistent with the existing row-style paths, and the dependencies use current records and column bounds. The full result-operation-record contract and targeted ESLint pass. Residual risk is limited to the actual VTable paint path, which still merits the documented manual UI check.

@openai0229
openai0229 merged commit b0da181 into OtterMind:main Aug 3, 2026
18 of 19 checks passed
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(result-grid): editing a cell clears new-row/deleted-row highlights until next sort

3 participants