ant-design / ant-design/pro-components
🧐[问题]ProFormList 第二次子项没有渲染问题
- 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 ? (
// onMouseLeave={() => setPreviewVisible(false)}
/>
{/* {previewVisible && (
预览
handleIconChange(nowIndex)}>删除
)} */}
handleIconChange(nowIndex)}
>
) : (
)}
{errorStatusIcon.includes(nowIndex) && (
请上传icon
)}
);
}}
新增配置
}
type="info"
showIcon
closable
/>
)}
### 🚑 其他信息

Contributor 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