fix(result-grid): re-apply create/delete highlights after arrangement reset - #2406
Conversation
… 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>
There was a problem hiding this comment.
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
customCellStyleArrangementclears cell→style mappings (not style definitions). - Re-applies create/delete row highlight arrangements immediately after the arrangement reset in the
cellChangeRecordListeffect. - Extends the effect dependency list to include
createRowRecordList,deleteRowRecordList, andcolumnsso 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 toforEachis 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
left a comment
There was a problem hiding this comment.
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.
What
The
cellChangeRecordListeffect clears VTablecustomCellStyleArrangementto 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, andcolumnsin the effect dependencies so every reset uses the current row records and column range. The loops useforEachbecause they only perform style side effects.Verification
main, including the latest result-grid recursion regression coverage.test:result-operation-recordcontract passes.Fixes #2405
🤖 Generated with Claude Code