ant-design / ant-design/pro-components

🐛[BUG]EditableProTable组件的编辑按钮没有正确反显列表数据

Open
#8,191 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 描述

先修改某一个字段值,例如案例中的状态,将第一条未解决改为全部,然后点击保存,保存里面的逻辑模拟调用后端接口,返回保存失败的情况,此时要保持编辑状态,并保持修改后的数据展示,此时如果点击取消,列表展示数据会正常恢复成修改前的数据,但是再次点击编辑时,反显的数据却是上一次修改保存失败的数据,此时如果再次点击取消,再点击编辑才会正常显示数据

### 📷 复现步骤

1、点击第一行的编辑按钮,将状态从未解决改为全部,然后点击保存
2、调用后端保存接口模拟保存失败的场景,此时需要继续保持编辑状态,并反显修改后的数据
3、此时点击取消,列表应该展示修改前的数据(此处已经实现)
4、再次点击第一行的编辑,发现状态哪一列的值展示为全部,不是未解决,反显的是之前修改失败的数据,如果此时再次点击取消,然后再来一次编辑,才会正常显示修改前的数据

### 🏞 期望结果

取消之后,再次点击编辑按钮能正常反显列表的数据,和列表展示的数据要保持一致

### 💻 复现代码

https://codesandbox.io/p/sandbox/ke-bian-ji-biao-ge-forked-mhv23c?file=%2FApp.tsx%3A142%2C1

### © 版本信息

- ProComponents 版本: [e.g. 4.0.0]
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]

### 🚑 其他信息

![image](https://github.com/ant-design/pro-components/assets/106509695/14d6cd93-42e3-4812-8e0a-e6a8dd88b091)

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodeSandbox, especially App.tsx around line 142, and reproduce the failed save followed by cancel and edit sequence in EditableProTable. Trace the edit and cancel state there, then verify that reopening edit mode reflects the same pre-edit data shown in the list after cancellation.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.