Skip to content

Commit

Permalink
last table row delete throwing error (#4270)
Browse files Browse the repository at this point in the history
Co-authored-by: Gerard Rovira <gerardrovira@meta.com>
  • Loading branch information
khanakia and zurfyx authored Apr 5, 2023
1 parent 9f297fa commit 2c8bfdb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/lexical-table/src/LexicalTableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,8 @@ export function $deleteTableRow__EXPERIMENTAL(): void {
}
const columnCount = gridMap[0].length;
const nextRow = gridMap[focusEndRow + 1];
const nextRowNode = grid.getChildAtIndex(focusEndRow + 1);
invariant(
DEPRECATED_$isGridRowNode(nextRowNode),
'Expected GridNode childAtIndex(%s) to be RowNode',
String(focusEndRow + 1),
const nextRowNode: null | DEPRECATED_GridRowNode = grid.getChildAtIndex(
focusEndRow + 1,
);
for (let row = focusEndRow; row >= anchorStartRow; row--) {
for (let column = columnCount - 1; column >= 0; column--) {
Expand All @@ -488,6 +485,7 @@ export function $deleteTableRow__EXPERIMENTAL(): void {
cellStartRow + cell.__rowSpan - 1 > focusEndRow
) {
cell.setRowSpan(cell.__rowSpan - (focusEndRow - cellStartRow + 1));
invariant(nextRowNode !== null, 'Expected nextRowNode not to be null');
if (column === 0) {
$insertFirst(nextRowNode, cell);
} else {
Expand Down

2 comments on commit 2c8bfdb

@vercel
Copy link

@vercel vercel bot commented on 2c8bfdb Apr 5, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

lexical – ./packages/lexical-website

lexical-fbopensource.vercel.app
www.lexical.dev
lexical-git-main-fbopensource.vercel.app
lexicaljs.com
lexicaljs.org
lexical.dev

@vercel
Copy link

@vercel vercel bot commented on 2c8bfdb Apr 5, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

lexical-playground – ./packages/lexical-playground

playground.lexical.dev
lexical-playground-git-main-fbopensource.vercel.app
lexical-playground-fbopensource.vercel.app
lexical-playground.vercel.app

Please sign in to comment.