Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form]有什么可以避免Form更新每个Item的onChange也会更新导致重渲染的方式 #4290

Open
xmsz opened this issue Mar 14, 2023 · 3 comments
Assignees
Labels
💡 Feature Request New feature or request improvement improve some features

Comments

@xmsz
Copy link

xmsz commented Mar 14, 2023

Component

Form

Feature Description

背景

const A = ({}:{onChange}) => {
  return <div>123</div>
}
<Form>
   <Form.Item name="a"><A/></Form.Item>
    <Form.Item name="b"><Input/></Form.Item>
</Form>
  • 在输入框输入后
  • A会一直重渲染,因为onChange会一直更新

理论上,onChange应该都是不变的

需求

  • 有什么办法可以解决这种情况
@lakerswgq
Copy link
Contributor

#4279 一个问题吧?

@xmsz
Copy link
Author

xmsz commented Mar 15, 2023

#4279 一个问题吧?

嗯 应该算上个问题的子问题

@jun599
Copy link
Contributor

jun599 commented Mar 17, 2023

就算onChange是不变的 A组件还是会重渲染 因为每当数据改变的时候 Form组件整个都会重渲染 跟目前的实现方式有关 我计划后续加一个新的api 是否开启对表单Item组件的渲染优化 通过这个功能去避免一些不必要的重渲染

@YunMeng99 YunMeng99 added the 💡 Feature Request New feature or request label Aug 10, 2023
@YSMJ1994 YSMJ1994 added the improvement improve some features label Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Feature Request New feature or request improvement improve some features
Projects
None yet
Development

No branches or pull requests

6 participants