pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

🐛[BUG]EditableProTable - 可编辑表格

Open yyj020304 opened this issue 1 week ago • 3 comments

提问前先看看:

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

🐛 bug 描述

EditableProTable - 可编辑表格 点击编辑时,如果在编辑态的数据超一条,第二条点击取消的数据会被删除,而不是取消编辑态

https://procomponents.ant.design/components/editable-table 官方示例就存在这个问题

📷 复现步骤

点击多条数据的编辑,不对数据进行更改,然后依次点击取消,第二条取消的数据会被删除

在官方示例就能复现

🏞 期望结果

除第一条编辑态的数据点击取消时不会被删除

💻 复现代码

© 版本信息

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

🚑 其他信息

yyj020304 avatar Dec 11 '25 03:12 yyj020304

以下的 Issues 可能会帮助到你 / The following issues may help you

  • [#9317][🐛[BUG]EditableProTable - 可编辑表格][100%]

github-actions[bot] avatar Dec 11 '25 03:12 github-actions[bot]

📝 CodeRabbit Plan Mode

Generate an implementation plan and prompts that you can use with your favorite coding agent.

  • [ ] Create Plan
Examples

🔗 Similar Issues

Possible Duplicates

Related Issues

👤 Suggested Assignees

  • yyj020304
  • xiaotianxia
  • LovePlayCode
  • 528244053

🧪 Issue enrichment is currently in early access.

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

coderabbitai[bot] avatar Dec 11 '25 03:12 coderabbitai[bot]

这是一个已知的 EditableProTable 问题:在多行编辑模式下,依次取消多行编辑时,第二条及之后的数据会被删除,而不是仅退出编辑态。根本原因是组件内部用来追踪“编辑前数据”的引用(preEditRowRef)在多行编辑时会被覆盖和清空,导致取消时误判为“新建行”并触发删除逻辑相关源码分析

这个 bug 已在官方 issue 跟踪(如 #9092),并且近期有一次大规模重构(PR #9295,2025-12-03 合并)对可编辑表格的编辑/取消逻辑进行了优化和修复,增加了多行编辑、取消等场景的测试,极有可能已经解决了该问题。

建议:

  1. 升级到包含 PR #9295 的最新版 pro-components,验证问题是否已修复。
  2. 如果暂时无法升级,可以参考 issue #7604 的 workaround:在取消时手动用 formRef.current.setFieldValues 恢复数据,或自行追踪每行的编辑前数据。

如需进一步跟进,可关注上述 issue 和 PR 的进展。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 11 '25 03:12 dosubot[bot]