alibaba / alibaba/lowcode-engine

project.removeDocument 后 被remove的document相关事件并不会被清理

Open
#2,662 0 comments 0 reactions 1 assignee Claimed by @liujuping View on GitHub
enhancement
Dominant language
TypeScript
Stars
15.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

```ts
removeDocument(doc: IDocumentModel) {
const index = this.documents.indexOf(doc);
if (index < 0) {
return;
}
this.documents.splice(index, 1);
this.documentsMap.delete(doc.id);
}
```

removeDocument 只是简单地把document从内部数组里删除。但document上挂载的事件(onChangeNodeProp)如还是要自己处理。

这会提高开发者的心智负担,document不能随便remove,甚至要对project/document再包裹一层来管理对象的生命周期。

建议引擎完善dispose方法,不要再依赖刷新页面解决🙏🏻

相关:
https://github.com/alibaba/lowcode-engine/issues/2181 (引擎目前提供的api,不足以在onRemoveDocument阶段清理事件)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.