antvis/G6

[V5]使用setData&render更新数据,combo数据会报Node not found for id: xx #5880

qishenliang posted onGitHub

Describe the bug / 问题描述

第一次更新数据没问题,第二次开始,只要更换了combos的数据(与原来有差异)的时候,就会报错,报错代码在graphlib的getNode()函数,在获取combo时,nodeMap里面node已经被删除

https://stackblitz.com/edit/react-ihejga?file=index.html,index.js

Steps to Reproduce the Bug or Issue / 重现步骤

等待第二秒定时器就会报错

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

No response


render 是异步方法,所以不要使用 setInterval ,你可以使用

graph.render().then(()=>{
  // ...
})

或者

await graph.render();

// ...
posted by Aarebecca 10 months ago

render 是异步方法,所以不要使用 setInterval ,你可以使用

graph.render().then(()=>{
  // ...
})

或者

await graph.render();

// ...

我更新了demo代码,麻烦您再看下,实际场景就是通过交互更新data

posted by qishenliang 10 months ago

Fund this Issue

$0.00
Funded

Pull requests