diff --git a/common/changes/@visactor/vtable/3766-bug-row-frozen-occor-error_2025-04-23-12-19.json b/common/changes/@visactor/vtable/3766-bug-row-frozen-occor-error_2025-04-23-12-19.json new file mode 100644 index 0000000000..bc06090d6b --- /dev/null +++ b/common/changes/@visactor/vtable/3766-bug-row-frozen-occor-error_2025-04-23-12-19.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: when records is blank updateColumns api occor error #3766\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file diff --git a/packages/vtable/src/ListTable.ts b/packages/vtable/src/ListTable.ts index 10535e0417..2826d04a31 100644 --- a/packages/vtable/src/ListTable.ts +++ b/packages/vtable/src/ListTable.ts @@ -213,6 +213,7 @@ export class ListTable extends BaseTable implements ListTableAPI { * Sets the define of the column. */ updateColumns(columns: ColumnsDefine) { + this.scenegraph.clearCells(); //将该代码提前 逻辑中有设置this.clear=true。refreshHeader逻辑中有判断clear这个值的地方 const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row }; this.internalProps.columns = cloneDeepSpec(columns, ['children']); generateAggregationForColumn(this); @@ -230,7 +231,7 @@ export class ListTable extends BaseTable implements ListTableAPI { this.dataSource.processRecords(this.dataSource.dataSourceObj?.records ?? this.dataSource.dataSourceObj); } this.internalProps.useOneRowHeightFillAll = false; - this.scenegraph.clearCells(); + this.headerStyleCache = new Map(); this.bodyStyleCache = new Map(); this.bodyBottomStyleCache = new Map();