Skip to content

Commit

Permalink
fix: fix react component error in updateCell() #2038
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Jul 5, 2024
1 parent 89cb688 commit 2045cf3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/vtable/src/scenegraph/group-creater/cell-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,11 @@ export function updateCell(col: number, row: number, table: BaseTableAPI, addNew
colForDefine = range.start.col;
rowForDefine = range.start.row;
}
const define =
const define: TextColumnDefine = (
cellLocation !== 'body'
? table.getHeaderDefine(colForDefine, rowForDefine)
: table.getBodyColumnDefine(colForDefine, rowForDefine);
: table.getBodyColumnDefine(colForDefine, rowForDefine)
) as any;

if (!range && (cellLocation !== 'body' || (define as TextColumnDefine)?.mergeCell)) {
// 只有表头或者column配置合并单元格后再进行信息获取
Expand All @@ -449,7 +450,12 @@ export function updateCell(col: number, row: number, table: BaseTableAPI, addNew
cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);

// fast method for text
if (!addNew && !isMerge && canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table)) {
if (
!addNew &&
!isMerge &&
!(define.customLayout || define.customRender || define.headerCustomLayout || define.headerCustomRender) &&
canUseFastUpdate(col, row, oldCellGroup, autoWrapText, table)
) {
// update group
const cellWidth = table.getColWidth(col);
const cellHeight = table.getRowHeight(row);
Expand Down Expand Up @@ -678,8 +684,10 @@ function updateCellContent(
// clear react container
if (table.reactCustomLayout) {
const reactGroup = oldCellGroup.getChildByName('custom-container');
const { col, row } = reactGroup;
table.reactCustomLayout.removeCustomCell(col, row);
if (reactGroup) {
const { col, row } = reactGroup;
table.reactCustomLayout.removeCustomCell(col, row);
}
}
}
const newCellGroup = createCell(
Expand Down

0 comments on commit 2045cf3

Please sign in to comment.