Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eightHundreds opened this issue Nov 17, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request / 新需求或者其他优化建议

Comments

@eightHundreds
Copy link
Contributor

eightHundreds commented Nov 17, 2023

  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方法,不要再依赖刷新页面解决🙏🏻

相关:
#2181 (引擎目前提供的api,不足以在onRemoveDocument阶段清理事件)

@JackLian JackLian added the enhancement New feature or request / 新需求或者其他优化建议 label Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request / 新需求或者其他优化建议
Projects
None yet
Development

No branches or pull requests

3 participants