[Bug] 列动态设置时,多个ListColumn设置CustomLayout会导致销毁异常,直接白屏
Open
@Rui-Sun is already working on this.
Since Dec 19, 2024.
bug
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 486
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 16
Description
Version
1.13.2
Link to Minimal Reproduction
https://visactor.io/vtable/demo-react/custom-layout/cell-custom-dom
Steps to Reproduce
import * as ReactVTable from "@visactor/react-vtable";
const { ListTable, ListColumn, Group, Text, Image } = ReactVTable;
<ListTable {...option} records={tableData?.data} ref={tableRef} ReactDOM={ReactDom}>
{columnState}
</ListTable>
columnState是根据数据setState更新,格式如下
<ListColumn key={dynamicFieldKey} {...commonProps} >
<CustomComponent
role="custom-layout"
element={xxxxx}
/>
</ListColumn>
const CustomComponent = useCallback((props: any) => {
const { table, row, col, rect, value, element } = props;
const rowData = table.getRecordByCell(col, row);
const { height, width } = rect || table.getCellRect(col, row);
return (
<Group
attribute={{
width,
height,
react: {
height,
width,
pointerEvents: true,
container: table.bodyDomContainer, // table.headerDomContainer
element: (
<div
style={{
display: "flex",
alignItems: "center",
height: "100%",
paddingLeft: 9,
userSelect: "none",
}}
>
{element?.(value, rowData)}
</div>
),
},
}}
/>
);
}, []);
Current Behavior
手动新增或删除列展示后直接白屏
控制台报错
Expected Behavior
能正常展示
Environment
- OS:window
- Browser:谷歌
- Framework:react@18.2.0
Any additional comments?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.