ant-design / ant-design/pro-components

🐛[BUG]proformselect的params为函数时不起作用

Open
#8,693 1 comment 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 描述

proformselect的params定义为函数或对象,但是当params为函数时,不起作用
```
params?: ((record: Entity, column: ProSchema) => Record) | Record;
```

### 📷 复现步骤

```
{
dataIndex: 'select',
label: 'select',
valueType: 'select',
params: { timestamp: Math.random() },
request: async (params) => {
console.log('params', params);
}
}
```
时,params为{timestamp:xxxx},且能触发request的重新请求。

```
{
dataIndex: 'select',
label: 'select',
valueType: 'select',
params: () => ({ timestamp: Math.random() }),
request: async (params) => {
console.log('params', params);
}
}
```
时params为空,且request未重新请求。

### 🏞 期望结果

当params为函数时,params不为空且能触发request的重新请求。

### 💻 复现代码

### © 版本信息

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

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start at the ProFormSelect handling for the params property and trace how it passes values to request. Compare the object and function forms shown in the report, then verify that the function result reaches request and causes a refresh with a focused regression test.

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.