ant-design / ant-design/pro-components

🐛[BUG] ProTable的columns列定义中,如果定义了formItemProps.rules,行编辑模式就会报错hook.js:608 Invalid prop `onKeyDown` supplied to `React.Fragment`

Open
#9,153 3 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

### 🐛 bug 描述

**Next.js 15 + react19** + ant design 5.26.2
兼容包也都加上了:
"@ant-design/nextjs-registry": "^1.0.2",
"@ant-design/v5-patch-for-react-19": "^1.0.3",

ProTable的columns列定义中,如果定义了formItemProps.rules,编辑模式就会报错:

![Image](https://github.com/user-attachments/assets/5ec78fe8-7b24-441f-b8c3-c971da26064d)

通过action?.startEditable?.(record.id);开启行编辑:
![Image](https://github.com/user-attachments/assets/40c19a87-adea-4b16-81d7-840fe16325f0)

![Image](https://github.com/user-attachments/assets/3d3ba679-2b7b-4c93-88bf-69e3fe8e166d)

### 📷 复现步骤

用的文档中的例子:
https://procomponents.ant.design/components/table?current=1&pageSize=5&tab=api#packages-table-src-components-table-tab-api-demo-single

只要删除rules就不报错,有rules就报错。
```typescript
{
title: "标题",
dataIndex: "title",
copyable: true,
ellipsis: true,
tooltip: "标题过长会自动收缩",
formItemProps: {
rules: [
{
required: true,
message: "此项为必填项",
},
],
},
},
```

### 🏞 期望结果

不报错

### 💻 复现代码

### © 版本信息

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

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start with the linked ProTable single-row-edit API example and reproduce the issue using Next.js 15, React 19, and Ant Design 5.26.2. Compare row editing with and without formItemProps.rules, then trace the source of the React.Fragment onKeyDown warning. Done means required rules work in row editing without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, 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.