Skip to content

Commit

Permalink
fix(editor): 更新组件配置后,如果当前没有任何依赖,不会触发收集,导致画布不更新
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Oct 9, 2024
1 parent d1a2044 commit c03de90
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/editor/src/services/dep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class Dep extends BaseService {
}

public collectIdle(nodes: MNode[], depExtendedData: DepExtendedData = {}, deep = false, type?: DepTargetType) {
let startTask = false;
this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
startTask = true;
idleTask.enqueueTask(
({ node, deep, target }) => {
this.collectNode(node, target, depExtendedData, deep);
Expand All @@ -93,6 +95,11 @@ class Dep extends BaseService {
});

return new Promise<void>((resolve) => {
if (!startTask) {
this.emit('collected', nodes, deep);
resolve();
return;
}
idleTask.once('finish', () => {
this.emit('collected', nodes, deep);
resolve();
Expand Down

0 comments on commit c03de90

Please sign in to comment.