If you use a React GNode renderer in a React project, the nodes are not re-rendered when the node data changes.
If node data is displayed in a GNode, it only renders once. After the data was updated, the node still shows the old data even though it was updated in the graph instance.
import { ExtensionCategory, Graph, register } from "@antv/g6";
import { GNode } from "@antv/g6-extension-react";
import CustomNodeRenderer from "./CustomNodeRenderer";
register(ExtensionCategory.NODE, "g", GNode);
const graph = new Graph({
data,
layout: {
type: "circular",
},
node: {
type: "g",
style: {
component: CustomNodeRenderer,
},
},
behaviors: ["drag-canvas", "zoom-canvas", "drag-element"],
});
// ...
// This does not trigger a re-render of the individual GNodes
graph.setData(updatedData);
graph.render();
Describe the bug / 问题描述
If you use a React GNode renderer in a React project, the nodes are not re-rendered when the node data changes.
If node data is displayed in a GNode, it only renders once. After the data was updated, the node still shows the old data even though it was updated in the graph instance.
The longer example for React can be found here: https://gist.github.com/jakobert/80b3f15c68f143a3a4343aacdcb62842
Reproduction link / 重现链接
https://gist.github.com/jakobert/80b3f15c68f143a3a4343aacdcb62842
Steps to Reproduce the Bug or Issue / 重现步骤
No response
G6 Version / G6 版本
🆕 5.x
Operating System / 操作系统
Windows
Browser / 浏览器
Chrome
Additional context / 补充说明
No response