alibaba / alibaba/lowcode-engine

node-children 中触发 'node.add' 事件的参数错误导致使用document.onMountNode报错

Open
#1,021 4 comments 0 reactions 0 assignees View on GitHub
WIP
Dominant language
TypeScript
Stars
15.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

## **Describe the bug (required)** / **详细描述 bug(必填)**

`node-children.ts` 中触发 `node.add` 事件的参数错误导致使用 `document.onMountNode()` 报错

---

## **To Reproduce (required)** / **如何复现 bug?(必填,非常重要)**

编写插件的 `init()` 函数中调用接口,输出结果多一层node,代码如下
```
project.currentDocument.onMountNode((node) => {
console.log('onMountNode', node, node?.node, node.node.parent);
});
```

---
## **Screenshots (optional)** / **bug 截图(可选)**
![调用时多了一层node](https://user-images.githubusercontent.com/16874003/188837021-209ca036-8782-449e-84ac-755cb118021e.png)

![定义是Node](https://user-images.githubusercontent.com/16874003/188837305-538755de-a609-46bb-b82b-a6a69b22e44e.png)

---

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in node-children.ts and trace where the node.add event is emitted for nodes mounted through document.onMountNode(). Reproduce the issue with the init() callback shown in the report and inspect the callback argument shape. Done means the callback receives the expected Node value without the extra node wrapper or resulting error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.