ant-design / ant-design/pro-components

🐛[BUG] ProTable树结构展示,二级以下取消按钮会触发onDelete删除

Open
#8,599 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

### 🐛 bug 描述

ProTable树结构展示,操作按钮,二级以下取消按钮会触发onDelete删除, 顶级菜单正常不会触发onDelete

### 📷 复现步骤

传入树结构给ProTable展示,二级以下取消按钮会触发onDelete删除

### 🏞 期望结果

二级以下操作按钮正常取消

### 💻 复现代码

```

columns={columns}
actionRef={actionRef}
rowKey="id"
scroll={{ x: 1300 }}
pagination={{
showSizeChanger: false,
}}
editable={{
type: 'multiple',
editableKeys,
onDelete: async (key, row) => {
message.success("为什么啊")
// const { code, msg } = await deleteSysMenu(row.id!);
// if (code === 200) {
// message.success(msg);
// } else {
// actionRef.current?.reload();
// }
},
onSave: async (rowKey, data) => {
const { code } = await updateSysMenu(data);
if (code === 200) {
message.success('更新成功');
}
},
onChange: setEditableRowKeys,
}}
request={async (params) => {
const { data } = await getSysMenuTree({
name: params.name,
type: params.type,
permission: params.permission,
});
if (data !== null) {
setMenuTree(data);
return {
data: data,
success: true,
};
}
message.info('没有找到数据');
return {
data: [],
success: true,
};
}}
toolBarRender={() => [
,
]}
/>
```

### © 版本信息

- ProComponents 版本: 2.4.4
- antd版本: 5.19.3
- umi 版本 @umijs/max 4.3.6
- 浏览器环境 Edge
- 开发环境 Window11专业版

### 🚑 其他信息

![image](https://github.com/user-attachments/assets/5a4683bb-9cbe-4a5d-9196-d257b0952e58)

Contributor guide

Open the contributing guide

Research direction

Start with ProTable's editable tree-table behavior using the reproduction code in the issue, focusing on how cancellation for rows below the top level is routed. Verify the behavior against ProComponents 2.4.4 and confirm that cancelling an edit no longer invokes onDelete for nested rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.