Skip to content

🐞fromJson不会触发node:added事件。 #4995

@tfn290181662

Description

@tfn290181662

问题描述

按官网文档描述:
当 options.silent 为 true 时,不触发 cell:added、node:added 和 edge:added 事件和画布重绘

实际不设置 options.silent或设置为false,均不会触发node:added 事件。是设计如此,还是BUG?

重现链接

https://codesandbox.io/p/devbox/delicate-worker-4m67pn?workspaceId=ws_Jz5W4gLT1GwMTYtJCueoGk

重现步骤

import { Graph } from "@antv/x6";

const graph = new Graph({
container: document.getElementById("container"),
grid: true,
});

graph.on("node:added", () => {
console.log("node:added");
});

graph.fromJSON(
{
nodes: [
{
shape: "rect",
width: 200,
height: 100,
},
],
},
{ silent: false }
);

预期行为

能正确触发node:added事件

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox ...]
  • X6 版本: [3.1.0 ...]

屏幕截图或视频(可选但最好有)

No response

补充说明(可选)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting for authorFurther information is requested from the author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions