antvis / antvis/X6

嵌套节点node.clone({deep: true})无效

Open
#4,228 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.7k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

嵌套节点node.clone({deep: true})无效,cloneNode.store.data.children有值,但是cloneNode.children和cloneNode._children没有值

![image](https://github.com/antvis/X6/assets/35559153/89b6981d-a309-42a2-ac7a-6bf320df20ad)

clone.setChildren(embeds), _children 在这里设置了但还是空数组
![image](https://github.com/antvis/X6/assets/35559153/4cb73a28-4101-4b6c-a4dc-d8f3308c3507)
![image](https://github.com/antvis/X6/assets/35559153/619da85f-6ac5-4bf3-8128-554df11f9ea4)

### Your Example Website or App

https://codesandbox.io/p/sandbox/elastic-wood-shyyk8?file=%2Findex.ts%3A10%2C27

### Steps to Reproduce the Bug or Issue

点击嵌套节点,复制的新节点没有子节点

### Expected behavior

deep: true能正常工作

### Screenshots or Videos

_No response_

### Platform

- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 2.11.1]

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodeSandbox reproduction and the node.clone({deep: true}) path described in the issue. Inspect how cloneNode.store.data.children relates to cloneNode.children and cloneNode._children, including the clone.setChildren(embeds) call. Done means clicking a nested node and copying it produces a clone whose child nodes are available through the expected properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.