antvis/G6

[V5] 在某些情况下render报错 #6004

Fly-Potato posted onGitHub

Describe the bug / 问题描述

我先实例化了一个Graph对象,然后往里面加入了50来个Node,以及8个Edge,调用render后报错

TypeError: node.getPorts is not a function
    at getAllPorts (element.ts:109:22)
    at findPort (element.ts:181:20)
    at findPorts (element.ts:162:22)
    at _Line.getEndpoints (base-edge.ts:265:38)
    at _Line.getKeyPath (line.ts:31:45)
    at _Line.getKeyStyle (base-edge.ts:235:96)
    at base-edge.ts:390:38
    at descriptor.value (effect.ts:33:24)
    at _Line.render (base-edge.ts:398:10)
    at _Line.update (base-shape.ts:99:10)

可以使用下面这组数据重现,官网示例使用下面的数据也会报错

data: {
        nodes: [
          {
            id: "9",
          },
          {
            id: "10",
          },
          {
            id: "11",
          },
          {
            id: "12",
          },
          {
            id: "13",
          },
          {
            id: "14",
          },
          {
            id: "41",
          },
          {
            id: "83",
          },
          {
            id: "89",
          },
          {
            id: "124",
          },
          {
            id: "125",
          },
          {
            id: "126",
          },
          {
            id: "127",
          },
          {
            id: "128",
          },
          {
            id: "162",
          },
          {
            id: "185",
          },
          {
            id: "214",
          },
          {
            id: "245",
          },
          {
            id: "247",
          },
          {
            id: "249",
          },
          {
            id: "252",
          },
          {
            id: "264",
          },
          {
            id: "266",
          },
          {
            id: "342",
          },
          {
            id: "346",
          },
          {
            id: "401",
          },
          {
            id: "402",
          },
          {
            id: "403",
          },
          {
            id: "480",
          },
          {
            id: "482",
          },
          {
            id: "483",
          },
          {
            id: "484",
          },
          {
            id: "519",
          },
          {
            id: "520",
          },
          {
            id: "614",
          },
          {
            id: "661",
          },
          {
            id: "664",
          },
          {
            id: "739",
          },
          {
            id: "740",
          },
          {
            id: "790",
          },
          {
            id: "814",
          },
          {
            id: "816",
          },
          {
            id: "818",
          },
          {
            id: "821",
          },
          {
            id: "878",
          },
          {
            id: "901",
          },
        ],
        edges: [
          {
            id: "124",
            source: "11",
            target: "124",
          },
          {
            id: "125",
            source: "11",
            target: "185",
          },
          {
            id: "126",
            source: "11",
            target: "41",
          },
          {
            id: "127",
            source: "11",
            target: "245",
          },
          {
            id: "128",
            source: "11",
            target: "125",
          },
          {
            id: "129",
            source: "11",
            target: "83",
          },
          {
            id: "131",
            source: "11",
            target: "128",
          },
          {
            id: "132",
            source: "11",
            target: "9",
          },
        ],
      },

No response

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

No response

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Edge

Additional context / 补充说明

No response


知道问题了,edge的id不能与node的id一样

posted by Fly-Potato 10 months ago

解决了我大问题,希望文档和示例能再完善一些

posted by Antony-Jia 6 months ago

Fund this Issue

$0.00
Funded

Pull requests