Fix perf of rectification after updateAttributes
Improve the id-detection algorithm in the "after save" hook to correctly handle "updateAttributes" as a single-model change and DO NOT trigger full "rectify all" scan.
This commit is contained in:
parent
15c1ac8bb5
commit
89326c7630
|
@ -1419,8 +1419,12 @@ module.exports = function(registry) {
|
|||
};
|
||||
|
||||
function rectifyOnSave(ctx, next) {
|
||||
if (ctx.instance) {
|
||||
ctx.Model.rectifyChange(ctx.instance.getId(), reportErrorAndNext);
|
||||
var instance = ctx.instance || ctx.currentInstance;
|
||||
var id = instance ? instance.getId() :
|
||||
getIdFromWhereByModelId(ctx.Model, ctx.where);
|
||||
|
||||
if (id) {
|
||||
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
||||
} else {
|
||||
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue