vue创建节点后添加子节点,撤销重做子节点出现重复创建
- Dominant language
- TypeScript
- Stars
- 6.7k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
### 问题描述
vue节点使用dnd拖拽到画布后监听node:added事件给node添加子节点,然后通过子节点的属性避免重复调用栈溢出,当撤销重做后,监听事件又会重复创建原来的子节点,然后再重复调用,然而关联的只有再次新建的那个,在vue节点的mounted事件中创建节点可以解决重复创建节点的问题,当创建了多个节点后全部一步步撤销,重做的时候只会回复一个。然后重做栈为0 ,想知道这个问题怎么解决
### 重现链接
https://codesandbox.io/s/distracted-bose-5tgl8j?file=/App.tsx
### 重现步骤
点击上一步到不能点击后点击下一步,会重复创建节点
### 预期行为
只创建添加一次子节点
### 平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox ...]
- X6 版本: [2.11.1 ...]
### 屏幕截图或视频(可选)
_No response_
### 补充说明(可选)
_No response_
Contributor guide
Research direction
Start with the App.tsx reproduction in the linked CodeSandbox and trace the node:added listener, child-node creation, and undo/redo actions. Compare that flow with creating nodes in the Vue node's mounted event. Done means repeatedly undoing and redoing multiple nodes creates each child only once and preserves all redo actions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100