Skip to content

Commit

Permalink
fix: fix oldRowHeights undefined problem in computeRowsHeight()
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Jul 4, 2024
1 parent fc0f5d0 commit f196524
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/vtable/src/scenegraph/layout/compute-row-height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export function computeRowsHeight(
if (update) {
for (let row = rowStart; row <= rowEnd; row++) {
const newRowHeight = newHeights[row] ?? table.getRowHeight(row);
if (newRowHeight !== oldRowHeights[row]) {
if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
table._setRowHeight(row, newRowHeight);
}
}
Expand All @@ -302,24 +302,24 @@ export function computeRowsHeight(
) {
for (let row = 0; row <= table.columnHeaderLevelCount - 1; row++) {
const newRowHeight = table.getRowHeight(row);
if (newRowHeight !== oldRowHeights[row]) {
if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
// update the row height in scenegraph
table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
}
}
for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) {
const newRowHeight = table.getRowHeight(row);
if (newRowHeight !== oldRowHeights[row]) {
if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
// update the row height in scenegraph
table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
}
}
}
for (let row = table.scenegraph.proxy.rowStart; row <= table.scenegraph.proxy.rowEnd; row++) {
const newRowHeight = table.getRowHeight(row);
if (newRowHeight !== oldRowHeights[row]) {
if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
// update the row height in scenegraph
table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
}
}
}
Expand Down

0 comments on commit f196524

Please sign in to comment.