antvis/G6

自定义布局在创建后,销毁画布,第二次进入还会提示The layout with the name exists already, it will be overridden #4616

lovelyGFR posted onGitHub

Describe the bug

自定义布局在创建后,销毁画布,第二次进入还会提示The layout with the name exists already, it will be overridden <img width="687" alt="image" src="https://github.com/antvis/G6/assets/48376890/5c4d70fe-8067-489a-96fc-b44c2634e69e">

Your Example Website or App

https://g6.antv.antgroup.com/zh/examples/net/layoutMechanism/#customBigraph

Steps to Reproduce the Bug or Issue

<img width="687" alt="image" src="https://github.com/antvis/G6/assets/48376890/744648a6-8e40-4ce3-8b36-59f2b08316b0">

Expected behavior

期望 : 都重新初始化,感觉总有上一次操作的痕迹 同时期望出一个G6各个事件,状态变化的生命周期,何时会导致重新draw,update等

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response


因为布局、节点、边是注册早 G6 上的,而不是 graph 实例,graph 实例被销毁了,不影响 G6 已经被注入的功能。这些注册的功能,只在引入 G6 的时候注册一次即可

posted by Yanyan-Wang almost 2 years ago

因为布局、节点、边是注册早 G6 上的,而不是 graph 实例,graph 实例被销毁了,不影响 G6 已经被注入的功能。这些注册的功能,只在引入 G6 的时候注册一次即可

那么应该在引入的时候判断一下有没有被注册,如果注册过就直接return吧,G6有没有提供对应的方法呢。 但是这样的话岂不是只有在页面刷新的时候才会清除G6的注册信息,不刷新则一直存在

posted by lovelyGFR almost 2 years ago

不能直接 return 呀,重名的功能就是需要覆盖的。刷新才清除,合理的呀

posted by Yanyan-Wang almost 2 years ago

Fund this Issue

$0.00
Funded

Pull requests