[lexical-table] Bug Fix: Deleting a row no longer drops a merged cell changed earlier in the same update #9851
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 310 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.343
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9851"
general
weight: 0.35
potatowagon
Description
$deleteTableRowAtSelectiontrims the row span of a merged cell that reaches past the deleted rows, and moves the cell into the next row when the deleted rows include its first row. It readcell.__rowSpanagain aftercell.setRowSpan(...), and a cell spanning several deleted rows was visited once per row.When the cell is not yet writable in the update,
setRowSpanclones it, socellkeeps the old span and this works. When the cell is already writable (for example$mergeCellsand$deleteTableRowAtSelectioncalled in oneeditor.update),setRowSpanchanges it in place:TableExtension, the row is padded with empty cells.Each cell is now handled once, from the span it had before the delete. Deleting rows in their own update, as the table menu does, already worked and is unchanged.
$deleteTableColumnAtSelectionreads the span before changing it and does not have this problem.Changeset
.changeset/table-delete-row-merged-cell-same-update.md(@lexical/tablepatch,[fix]with aVerify:paragraph).Test plan
New
DeleteRowMergedCellSameUpdate.test.tsruns three cases (2-row merge, 2x2 merge, 4-row merge with two rows deleted) with the merge and the delete in separate updates and in the same update.pnpm exec vitest run --project unit packages/lexical-table/src/__tests__/unit/DeleteRowMergedCellSameUpdate.test.tsBefore
After
pnpm exec vitest run --project unit packages/lexical-table: 38 files passed, 395 passed | 9 expected fail.pnpm run tsc, ESLint and Prettier on the changed files, andpnpm run check-changesetspass. Flow, browser and e2e tests were not run; the change has no API or DOM impact.