改进了一下watcher的调用逻辑

This commit is contained in:
Xu Chang 2023-10-08 13:38:54 +08:00
parent 9e40ca4002
commit e4fd026e03
2 changed files with 8 additions and 4 deletions

View File

@ -158,8 +158,10 @@ class AppLoader extends types_1.AppLoader {
dontCollect: true,
blockTrigger: true,
});
const result = await fn(context, rows);
console.log(`执行了watcher【${w.name}】,结果是:`, result);
if (rows.length > 0) {
const result = await fn(context, rows);
console.log(`执行了watcher【${w.name}】,结果是:`, result);
}
}
await context.commit();
}

View File

@ -199,8 +199,10 @@ export class AppLoader<ED extends EntityDict & BaseEntityDict, Cxt extends Backe
blockTrigger: true,
});
const result = await fn(context, rows);
console.log(`执行了watcher【${w.name}】,结果是:`, result);
if (rows.length > 0) {
const result = await fn(context, rows);
console.log(`执行了watcher【${w.name}】,结果是:`, result);
}
}
await context.commit();
}