ant-design / ant-design/pro-components

🧐[问题]ProFormList 第二次子项没有渲染问题

Open
#8,896 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

### 🧐 问题描述

问题:现在这个proformList 渲染由另外一个变量isChecked控制,当首次isChecked为true,fromList里面各个字段ProFormText ProFormSelect等都会渲染出来,但是第二次isChecked为true时, console.log('meta--', meta); 这一行代码都没有执行到,导致 之后切换的 isChecked:true 这个proFormList 没有渲染出来。有尝试给proformList 定义key ,const [refreshKey, setRefreshKey] = useState(0); 发现没有效果。希望找到原因,和可能解决方法
代码如下:

### 💻 示例代码








{isChecked && (


{
console.log('itemRender', record, index);
return (
handleDelete(index)}
/>
)
}
title={`悬浮按钮 ${digitToChinese(index + 1)}`}
style={{
marginBlockEnd: 8,
}}
>
{listDom}

);
}}
actionRef={actionRef}
>
{(meta, nowIndex) => {
console.log('meta--', meta);
return (

{nowIndex}==

handleNameChange(e, nowIndex)}
rules={[
{
required: true,
message: '请输入标题',
},
]}
/>


{({ type }) => {
console.log(type);
return (

{type === 'link' ? (

) : (

)}

);
}}

handleWeightChange(e, nowIndex)}
/>



按钮icon:


{servicesIconList[nowIndex]?.icon ? (

setPreviewVisible(true)}
// onMouseLeave={() => setPreviewVisible(false)}
/>
{/* {previewVisible && (

预览
handleIconChange(nowIndex)}>删除

)} */}
handleIconChange(nowIndex)}
>



) : (

)}
{errorStatusIcon.includes(nowIndex) && (

请上传icon

)}



);
}}


新增配置



注意:链接不能涉及第三方的收费服务(包跳转页内的二次跳转),否则需要先走法务合规,

查看智能体合规建议



}
type="info"
showIcon
closable
/>



)}


### 🚑 其他信息

![2024-11-28 12 35 58](https://github.com/user-attachments/assets/1a7a5ffe-71b4-478e-bfca-5c176ca6d0ae)

Contributor guide

Open the contributing guide

Research direction

Start with the provided ProFormList reproduction and trace what happens when isChecked toggles off and on a second time. Compare the first and second renders, focusing on the ProFormList child callback and its initialValue, and consider the issue resolved when the list fields render consistently on every toggle.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.