Skip to content

Commit

Permalink
Merge pull request #3037 from KorovinQuantori/hotfix
Browse files Browse the repository at this point in the history
Hotfix: reset cell entries list when table is overflown
  • Loading branch information
zbeyens authored Mar 20, 2024
2 parents 6eda8a5 + 99cc479 commit d28e020
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chatty-flowers-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@udecode/plate-table": patch
---

Hotfix: reset cell entries list when table is overflown
3 changes: 2 additions & 1 deletion packages/table/src/merge/getTableGridByRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const getTableMergeGridByRange = <T extends FormatType, V extends Value>(
newCellChildren: [],
});

const cellEntries: TElementEntry[] = [];
let cellEntries: TElementEntry[] = [];
let cellsSet = new WeakSet();

let rowIndex = startRowIndex;
Expand Down Expand Up @@ -137,6 +137,7 @@ export const getTableMergeGridByRange = <T extends FormatType, V extends Value>(
) {
// reset the cycle if has overflow
cellsSet = new WeakSet();
cellEntries = [];
startRowIndex = Math.min(startRowIndex, cellRow);
endRowIndex = Math.max(endRowIndex, cellRowWithSpan);
startColIndex = Math.min(startColIndex, cellCol);
Expand Down

0 comments on commit d28e020

Please sign in to comment.