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) {
|
function rectifyOnSave(ctx, next) {
|
||||||
if (ctx.instance) {
|
var instance = ctx.instance || ctx.currentInstance;
|
||||||
ctx.Model.rectifyChange(ctx.instance.getId(), reportErrorAndNext);
|
var id = instance ? instance.getId() :
|
||||||
|
getIdFromWhereByModelId(ctx.Model, ctx.where);
|
||||||
|
|
||||||
|
if (id) {
|
||||||
|
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
||||||
} else {
|
} else {
|
||||||
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue