Skip to content

Commit

Permalink
fix(mindmap demo): can not find target id when create edge (antvis#3144)
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydzhou authored Jan 16, 2023
1 parent df24392 commit bfc8d7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/x6-example-features/src/pages/case/mind.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,13 @@ export default class Example extends React.Component {
if (children) {
children.forEach((item: HierarchyResult) => {
const { id, data } = item
// 先遍历子节点(里面包含创建逻辑,如果画布没有开启async的时候,创建边会提示找不到target节点)
traverse(item)
const eid = `${hierarchyItem.id}-->${id}`
// 检查当前边是否已经存在
if (!graph.hasCell(eid)) {
graph.addEdge({
id: `${hierarchyItem.id}-->${id}`,
id: eid,
shape: 'mindmap-edge',
source: {
cell: hierarchyItem.id,
Expand All @@ -265,7 +267,6 @@ export default class Example extends React.Component {
},
})
}
traverse(item)
})
}
}
Expand Down

0 comments on commit bfc8d7f

Please sign in to comment.