Skip to content

Commit

Permalink
fix TypeError: Cannot read property '_id' of null
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhaolin committed Aug 21, 2024
1 parent bcafc66 commit b30e24f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/standard-objects/base.trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ const beforeUpdateBase = async function () {
}
const afterDeleteBase = async function () {
const { object_name, previousDoc } = this;
if (!previousDoc) {
return;
}

const object = objectql.getObject(object_name);
const objectConfig = object.toConfig();
const fields = objectConfig.fields;
Expand Down
2 changes: 1 addition & 1 deletion services/standard-space/package.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = {
// console.log(require('chalk').red('-------------------@*.deleted-------------------'), ctx.params)
const params = ctx.params
const { isDelete, isAfter, previousDoc, objectName } = params;
if (isAfter && isDelete) {
if (isAfter && isDelete && previousDoc) {
const spaceId = previousDoc.space;
const obj = objectql.getObject(objectName);
const detailsInfo = await obj.getDetailsInfo(); // 查找当前哪些对象有masterDetail字段引用当前对象
Expand Down

0 comments on commit b30e24f

Please sign in to comment.