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: 插槽组件局部更新使得事件id增长,极端情况下可能导致页面卡死 #5033

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

acyza
Copy link

@acyza acyza commented Jul 12, 2024

插槽组件局部更新会导致事件id变化,如果插槽内有大量事件(如:插槽内是列表每条都加点击事件),每次更新都会事件id都会大量增长。

事件id变化又可能触发局部组件渲染,无限循环导致页面卡死(似乎复现条件较为苛刻,这个demo我调了好久才成功复现,且仅在钉钉小程序中有效)

https://github.com/acyza/uni-app/tree/pr_2_demo
此demo仅在钉钉小程序中复现,在开发者工具中可以看到插槽中的事件id在无限刷新(注:demo页较为简单,可能并未导致页面完全卡死,复杂点的页面是可能会卡死的)。

image

此pr将插槽内的id生成,从使用插槽所在组件实例生成改为使用插槽组件id+插槽组件生成事件id,确保id唯一且部分组件单独重新渲染也不会导致id无限增长

@acyza acyza changed the title fix: 插槽组件局部更新导致事件id变化 fix: 插槽组件局部更新导致事件的自增id大量增长 Jul 13, 2024
@acyza acyza changed the title fix: 插槽组件局部更新导致事件的自增id大量增长 fix: 插槽组件局部更新使得事件id增长,极端情况下可能导致页面卡死 Aug 21, 2024
@acyza acyza closed this Sep 7, 2024
@acyza acyza reopened this Sep 7, 2024
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

Successfully merging this pull request may close these issues.

1 participant