Use `ctx.instance` provided by "after delete" hook
Use the recently added context property `ctx.instance` to improve the accuracy of the algorithm detecting whether a single or multiple models were deleted.
This commit is contained in:
parent
911d8323b4
commit
cadb5e4524
|
@ -1362,7 +1362,9 @@ function rectifyOnSave(ctx, next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function rectifyOnDelete(ctx, next) {
|
function rectifyOnDelete(ctx, next) {
|
||||||
var id = getIdFromWhereByModelId(ctx.Model, ctx.where);
|
var id = ctx.instance ? ctx.instance.getId() :
|
||||||
|
getIdFromWhereByModelId(ctx.Model, ctx.where);
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue