From da898603599cb1b08123be07c8999b0ad49f4d0b Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 20 Dec 2024 11:36:53 +0800 Subject: [PATCH] fix: fix customRender error in react-vtable #3142 --- .../vtable/fix-graphic-html_2024-12-20-03-36.json | 10 ++++++++++ .../vtable/src/scenegraph/group-creater/cell-helper.ts | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-graphic-html_2024-12-20-03-36.json diff --git a/common/changes/@visactor/vtable/fix-graphic-html_2024-12-20-03-36.json b/common/changes/@visactor/vtable/fix-graphic-html_2024-12-20-03-36.json new file mode 100644 index 000000000..fdb8ad30d --- /dev/null +++ b/common/changes/@visactor/vtable/fix-graphic-html_2024-12-20-03-36.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix customRender error in react-vtable #3142", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts index cdc2ec73e..5cb097d59 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -33,7 +33,7 @@ import type { CreateCheckboxCellGroup } from './cell-type/checkbox-cell'; import { getHierarchyOffset } from '../utils/get-hierarchy-offset'; import { getQuadProps } from '../utils/padding'; import { updateCellContentHeight, updateCellContentWidth } from '../utils/text-icon-layout'; -import { isArray, isValid } from '@visactor/vutils'; +import { isArray, isNumber, isValid } from '@visactor/vutils'; import { breakString } from '../utils/break-string'; import type { CreateRadioCellGroup } from './cell-type/radio-cell'; import { onBeforeAttributeUpdateForInvertHighlight } from '../../plugins/invert-highlight'; @@ -775,7 +775,9 @@ function updateCellContent( const reactGroup = oldCellGroup.getChildByName('custom-container'); if (reactGroup) { const { col, row } = reactGroup; - table.reactCustomLayout.removeCustomCell(col, row); + if (isNumber(col) && isNumber(row)) { + table.reactCustomLayout.removeCustomCell(col, row); + } } } }