generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 37
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
🐛[BUG] useStyles和useTheme的性能问题 #173
Comments
嗯,#158 的问题的确存在。上次看过一次,一下子没找到解决方案,最近有空的时候再研究下怎么解比较好。核心应该还是因为引用不同造成了 re-render |
好的谢谢,还有个问题就是主题色切换反应有些慢,这个有的解吗,包括lobechat也有这个问题,在页面更复杂的时候这个时间可能会更久。 |
这个应该可以用 cssvar 解。你试下 antd 官网的主题切换速度 OK 吗? |
useStyles的性能问题,短期有计划解决吗 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 bug 描述
在我的基础组件Iconfont中我使用了useStyles,这个icon被应用到了antd 虚拟滚动的tree中,
现在我遇到了性能问题,每个icon的渲染都会执行useStyles,我看到createStylesFactory这个方法的执行时间在20ms,这对虚拟滚动的场景应该是不能接受的。
我觉得这个问题同 #158
📷 复现步骤
🏞 期望结果
可以优化useStyles的时间,或者能不能有一个单例的useStyles,没必要每个组件都要去执行useStyles
💻 复现代码
可复现demo: https://codesandbox.io/p/sandbox/frosty-chatelet-j23j8m?file=%2Fsrc%2FDemo.tsx%3A10%2C1
© 版本信息
🚑 其他信息
The text was updated successfully, but these errors were encountered: