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

[useDeepCompareEffect] 在组件re-render时进行depsEqual造成性能问题 #2577

Open
ruixingshi opened this issue Jun 23, 2024 · 0 comments

Comments

@ruixingshi
Copy link
Contributor

在更新State为相同数据后,组件因为其他State/Props进行re-render时,useDeepCompareEffect会一直进行深度对比,导致严重的性能问题(因为真实数据层级较多)。

DEMO: https://codesandbox.io/p/sandbox/use-deep-compare-effect-t9f984?file=%2Fsrc%2FApp.tsx%3A31%2C5

复现步骤:
1、初始化页面
2、重新设置data为相同数据
3、设置其他state,重新渲染页面时,打开控制台,可以看到会进行data的深度对比

cc @caorushizi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant