fix: 修复一处类型错误

This commit is contained in:
Pan Qiancheng 2025-12-02 15:13:53 +08:00
parent a547f1d890
commit 0fc00a02b4
3 changed files with 16 additions and 14 deletions

View File

@ -147,13 +147,12 @@ export default class TreeStore extends CascadeStore {
this.seq = {};
}
constructRow(node, context, option) {
let data = cloneDeep(node.$current);
if (context.getCurrentTxnId() && node.$txnId === context.getCurrentTxnId()) {
if (!node.$next) {
// 如果要求返回delete数据返回带$$deleteAt$$的行
// bug fixed这里如果是自己create再删除data也是null
if (data && option?.includedDeleted) {
return Object.assign({}, data, {
if (node.$current && option?.includedDeleted) {
return Object.assign({}, node.$current, {
[DeleteAtAttribute]: 1,
});
}
@ -161,19 +160,21 @@ export default class TreeStore extends CascadeStore {
}
else if (!node.$current) {
// 本事务创建的若在cache中$$createAt$$和$$updateAt$$置为1
return Object.assign({}, data, node.$next, context instanceof SyncContext && {
return Object.assign({}, node.$current, node.$next, context instanceof SyncContext && {
[CreateAtAttribute]: 1,
[UpdateAtAttribute]: 1,
});
}
else {
// 本事务更新的若在cache中$$updateAt$$置为1
return Object.assign({}, data, node.$next, context instanceof SyncContext && {
return Object.assign({}, node.$current, node.$next, context instanceof SyncContext && {
[UpdateAtAttribute]: 1,
});
}
}
return data;
return {
...node.$current,
};
}
testFilterFns(node, nodeDict, exprResolveFns, fns) {
const { self, otm, mto } = fns;

View File

@ -149,13 +149,12 @@ class TreeStore extends CascadeStore_1.CascadeStore {
this.seq = {};
}
constructRow(node, context, option) {
let data = (0, lodash_1.cloneDeep)(node.$current);
if (context.getCurrentTxnId() && node.$txnId === context.getCurrentTxnId()) {
if (!node.$next) {
// 如果要求返回delete数据返回带$$deleteAt$$的行
// bug fixed这里如果是自己create再删除data也是null
if (data && option?.includedDeleted) {
return Object.assign({}, data, {
if (node.$current && option?.includedDeleted) {
return Object.assign({}, node.$current, {
[Entity_1.DeleteAtAttribute]: 1,
});
}
@ -163,19 +162,21 @@ class TreeStore extends CascadeStore_1.CascadeStore {
}
else if (!node.$current) {
// 本事务创建的若在cache中$$createAt$$和$$updateAt$$置为1
return Object.assign({}, data, node.$next, context instanceof SyncRowStore_1.SyncContext && {
return Object.assign({}, node.$current, node.$next, context instanceof SyncRowStore_1.SyncContext && {
[Entity_1.CreateAtAttribute]: 1,
[Entity_1.UpdateAtAttribute]: 1,
});
}
else {
// 本事务更新的若在cache中$$updateAt$$置为1
return Object.assign({}, data, node.$next, context instanceof SyncRowStore_1.SyncContext && {
return Object.assign({}, node.$current, node.$next, context instanceof SyncRowStore_1.SyncContext && {
[Entity_1.UpdateAtAttribute]: 1,
});
}
}
return data;
return {
...node.$current,
};
}
testFilterFns(node, nodeDict, exprResolveFns, fns) {
const { self, otm, mto } = fns;

View File

@ -233,7 +233,7 @@ export default class TreeStore<ED extends EntityDict & BaseEntityDict> extends C
}
else if (!node.$current) {
// 本事务创建的若在cache中$$createAt$$和$$updateAt$$置为1
return Object.assign({}, node.$next, context instanceof SyncContext && {
return Object.assign({}, node.$current, node.$next, context instanceof SyncContext && {
[CreateAtAttribute]: 1,
[UpdateAtAttribute]: 1,
});
@ -242,7 +242,7 @@ export default class TreeStore<ED extends EntityDict & BaseEntityDict> extends C
// 本事务更新的若在cache中$$updateAt$$置为1
return Object.assign({}, node.$current, node.$next, context instanceof SyncContext && {
[UpdateAtAttribute]: 1,
});
})
}
}
return {