-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(form): 修复form自定义组件过多卡顿的问题 #7018
Conversation
🎊 PR Preview has been successfully built and deployed to https://pro-components-preview-pr-7018.surge.sh |
合并后期望发一个版 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #7018 +/- ##
==========================================
+ Coverage 97.71% 98.04% +0.32%
==========================================
Files 338 338
Lines 11025 11030 +5
Branches 3988 3983 -5
==========================================
+ Hits 10773 10814 +41
+ Misses 209 173 -36
Partials 43 43
☔ View full report in Codecov by Sentry. |
|
||
const memoFieldProps = useMemo( | ||
() => ({ | ||
autoFocus, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样不会有什么帮助吧?有性能对比嘛?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对比过了,原来的写法会导致每次自定义组件的onchange都是新的,导致重新渲染
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://codesandbox.io/s/schema-biao-dan-forked-plcfp?file=/App.tsx
把这个demo改造下用最新的14版本,在本地跑跑看就知道了,我就是用这个测试的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
给个报告吧 change 是个方法 diff 方法没什么意义的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
准确比性能 重要,如果性能优化不能覆盖风险,那就没必要让用户承担这个心智
4b68d5d
to
788d19e
Compare
@chenshuai2144 现在单测我也加了,我认为有问题的地方我也改了,麻烦cr下呢 |
@Dunqing 也来看看这个问题吧 |
@chenshuai2144 @Dunqing 这个PR来看看啊。线上环境着急用 |
我这PR看来有点难度😂,迟迟不能合并 |
ci 修一下 |
done |
建议这样子的写法以后注意下,这个问题反反复复的出现