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

【V5】事件处理陷入无限循环,导致页面假死 #5964

Closed
wulianpu opened this issue Jul 2, 2024 · 6 comments
Closed

【V5】事件处理陷入无限循环,导致页面假死 #5964

wulianpu opened this issue Jul 2, 2024 · 6 comments

Comments

@wulianpu
Copy link

wulianpu commented Jul 2, 2024

事件处理代码见:https://github.com/antvis/G/blob/ffdef423496adc3b663f9fa3eb70da53d76931d0/packages/g-lite/src/services/EventService.ts#L386-L400

while (leaveEvent.target &&!e.composedPath().includes(leaveEvent.target)) {
  leaveEvent.currentTarget = leaveEvent.target;

  this.notifyTarget(leaveEvent);
  if (isMouse) {
    this.notifyTarget(leaveEvent, 'mouseleave');
  }

  if (Node.isNode(leaveEvent.target)) {
    leaveEvent.target = leaveEvent.target.parentNode;
  }
}

如果 leaveEvent.target 不是Node,就会导致一直在循环

@wulianpu wulianpu changed the title 事件处理陷入无限循环,导致页面假死 【V5】事件处理陷入无限循环,导致页面假死 Jul 2, 2024
@Aarebecca
Copy link
Contributor

反馈的问题在 G6 中有所体现吗

@wulianpu
Copy link
Author

wulianpu commented Jul 3, 2024

反馈的问题在 G6 中有所体现吗

有的,我之前试过用最小代码来复现,但一直没成功...

@Aarebecca
Copy link
Contributor

麻烦提供一个复现 demo 呢

@wulianpu
Copy link
Author

wulianpu commented Jul 3, 2024

麻烦提供一个复现 demo 呢

CodeSandbox:https://codesandbox.io/p/devbox/g6-demo-vue3-9w9pjz

预览地址:https://9w9pjz-5173.csb.app

多点几次节点就可以复现问题了
image

问题应该是使用了 Ref包装的 Graph 对象的原因

@Aarebecca
Copy link
Contributor

问题出现在底层渲染引擎的事件系统,可能需要到对应的仓库提下 issue:https://github.com/antvis/g

@Aarebecca
Copy link
Contributor

transfer to: antvis/G#1725

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

2 participants