ant-design / ant-design/pro-components

🐛[BUG] 当编辑用:action?.startEditable?.(record.uuid) 不传第二个参数时,取消行动点会删除整行

Open
#8,951 2 comments 1 reaction 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 描述
使用EditableProTable配合 ProForm 使用时,出现取消行动点删除整行的情况。 经排查, action?.startEditable?.(record.uuid, record); 这个需要使用第二个参数,不然就会出现我上诉提到的问题。

### 📷 复现步骤
1. EditableProTable配合 ProForm 使用。如官方例子。
2. 编辑的时候这样写:action?.startEditable?.(record.id);
3. 进入编辑态点击取消,整行随之取消。
image
image
可以看到已经删掉了。

### 🏞 期望结果
取消不用删整行

### 💻 复现代码
`
{
return {
rules: [{ required: true, message: '此项为必填项' }],
};
},
width: '30%',
},
{
title: '状态',
key: 'state',
dataIndex: 'state',
valueType: 'select',
valueEnum: {
all: { text: '全部', status: 'Default' },
open: {
text: '未解决',
status: 'Error',
},
closed: {
text: '已解决',
status: 'Success',
},
},
},
{
title: '描述',
dataIndex: 'decs',
},
{
title: '活动时间',
dataIndex: 'created_at',
valueType: 'date',
},
{
title: '操作',
valueType: 'option',
width: 200,
render: (text, record, _, action) => [
{
action?.startEditable?.(record.uuid);
}}
>
编辑
,
],
},
]}
editable={{
type: 'multiple',
editableKeys,
onChange: setEditableRowKeys,
actionRender: (row, config, defaultDom) => {
return [defaultDom.save, defaultDom.delete, defaultDom.cancel];
},
}}
/>



{({ table }) => {
return (

);
}}



`

### © 版本信息

- ProComponents 版本: 2.31.2
- umi 版本: 4
- 浏览器环境: 谷歌浏览器
- 开发环境:mac

Contributor guide

Open the contributing guide

Research direction

Start at the EditableProTable entry point and trace the action?.startEditable?.(record.uuid) and cancel flow when the component is used with ProForm. Reproduce the issue with the supplied example, then verify that canceling after starting edit without the second argument no longer removes the row. Add or update coverage for this scenario if the relevant test location is found.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.