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

fix(form): 修复form自定义组件过多卡顿的问题 #7018

Merged
merged 2 commits into from
May 12, 2023

Conversation

ldwonday
Copy link
Contributor

@ldwonday ldwonday commented May 5, 2023

建议这样子的写法以后注意下,这个问题反反复复的出现

@github-actions
Copy link

github-actions bot commented May 5, 2023

🎊 PR Preview has been successfully built and deployed to https://pro-components-preview-pr-7018.surge.sh

@ldwonday
Copy link
Contributor Author

ldwonday commented May 5, 2023

合并后期望发一个版

@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.32 🎉

Comparison is base (1cf4bfa) 97.71% compared to head (a45cafe) 98.04%.

❗ Current head a45cafe differs from pull request most recent head b8971de. Consider uploading reports for the commit b8971de to get more accurate results

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              
Impacted Files Coverage Δ
packages/form/src/components/SchemaForm/index.tsx 100.00% <ø> (ø)
...layout/src/components/Help/ProHelpContentPanel.tsx 96.92% <ø> (+36.31%) ⬆️
.../layout/src/components/Help/RenderContentPanel.tsx 97.61% <ø> (+11.90%) ⬆️
...ages/layout/src/components/SiderMenu/style/menu.ts 100.00% <ø> (ø)
...kages/table/src/components/EditableTable/index.tsx 99.30% <ø> (ø)
packages/descriptions/src/useFetchData.tsx 100.00% <100.00%> (+3.03%) ⬆️
packages/form/src/components/Field/index.tsx 97.72% <100.00%> (+0.16%) ⬆️
packages/form/src/components/List/index.tsx 100.00% <100.00%> (ø)
...form/src/components/SchemaForm/valueType/field.tsx 100.00% <100.00%> (ø)
packages/table/src/Table.tsx 99.15% <100.00%> (ø)
... and 2 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.


const memoFieldProps = useMemo(
() => ({
autoFocus,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样不会有什么帮助吧?有性能对比嘛?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对比过了,原来的写法会导致每次自定义组件的onchange都是新的,导致重新渲染

Copy link
Contributor Author

@ldwonday ldwonday May 5, 2023

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版本,在本地跑跑看就知道了,我就是用这个测试的

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

给个报告吧 change 是个方法 diff 方法没什么意义的

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

准确比性能 重要,如果性能优化不能覆盖风险,那就没必要让用户承担这个心智

@ldwonday ldwonday force-pushed the fix/form-bug branch 7 times, most recently from 4b68d5d to 788d19e Compare May 6, 2023 08:45
@ldwonday
Copy link
Contributor Author

ldwonday commented May 6, 2023

@chenshuai2144 现在单测我也加了,我认为有问题的地方我也改了,麻烦cr下呢

@ldwonday
Copy link
Contributor Author

ldwonday commented May 6, 2023

@Dunqing 也来看看这个问题吧

@ldwonday
Copy link
Contributor Author

ldwonday commented May 8, 2023

@chenshuai2144 @Dunqing 这个PR来看看啊。线上环境着急用

@chenshuai2144 chenshuai2144 changed the title fix: 修复form自定义组件过多卡顿的问题 fix(form): 修复form自定义组件过多卡顿的问题 May 8, 2023
@ldwonday
Copy link
Contributor Author

我这PR看来有点难度😂,迟迟不能合并

@chenshuai2144
Copy link
Contributor

ci 修一下

@ldwonday
Copy link
Contributor Author

done

@chenshuai2144 chenshuai2144 merged commit ca2e8e1 into ant-design:master May 12, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants