ant-design / ant-design/pro-components

🐛[BUG] proTable的fromItem设置了search.transform,触发onchange的时候也触发了search.transform

Open
#7,242 3 comments 1 reaction 0 assignees View on GitHub
AI Reply
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

### 🐛 bug 描述

proTable的fromItem设置了search.transform,触发onchange的时候也触发了search.transform

### 🏞 期望结果

变更不应该走search.transform
提交的时候才走search.transform

### 💻 复现代码

` {
dataIndex: 'name',
fieldProps: {
autoClearSearchValue: false,
mode: 'multiple',
placeholder: '输入关键字查询',
showSearch: true,
},
request: fetchPhysicalWarehouseList,
search: {
transform: (value) => ({ title: (value || []).join(',') }),
},
title: '名称',
valueType: 'select',
},
{
dataIndex: 'type',
hideInTable: true,
renderFormItem: () => {
return (

{({ name}) => {
// 没有返回name,返回了title,并且是被search.transform后的数据
console.log(name, 'name');
return (

);
}}

);
},
title: '类型',
valueType: 'select',
},
`

### © 版本信息

- ProComponents 版本: 2.5.10

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided ProTable configuration with the `name` field's `search.transform` and the dependent `type` field. Verify that changing the field exposes the original `name` value to ProFormDependency, while submitting still applies the transform; the issue is done when those two behaviors are separated.

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
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.