修改了constructRow中的无条件cloneDeep
This commit is contained in:
parent
5b5621216f
commit
c82bf99fdb
13
src/store.ts
13
src/store.ts
|
|
@ -219,13 +219,12 @@ export default class TreeStore<ED extends EntityDict & BaseEntityDict> extends C
|
||||||
}
|
}
|
||||||
|
|
||||||
private constructRow<Cxt extends Context, OP extends TreeStoreSelectOption>(node: RowNode, context: Cxt, option?: OP) {
|
private constructRow<Cxt extends Context, OP extends TreeStoreSelectOption>(node: RowNode, context: Cxt, option?: OP) {
|
||||||
let data = cloneDeep(node.$current);
|
|
||||||
if (context.getCurrentTxnId() && node.$txnId === context.getCurrentTxnId()) {
|
if (context.getCurrentTxnId() && node.$txnId === context.getCurrentTxnId()) {
|
||||||
if (!node.$next) {
|
if (!node.$next) {
|
||||||
// 如果要求返回delete数据,返回带$$deleteAt$$的行
|
// 如果要求返回delete数据,返回带$$deleteAt$$的行
|
||||||
// bug fixed,这里如果是自己create再删除,data也是null
|
// bug fixed,这里如果是自己create再删除,data也是null
|
||||||
if (data && option?.includedDeleted) {
|
if (node.$current && option?.includedDeleted) {
|
||||||
return Object.assign({}, data, {
|
return Object.assign({}, node.$current, {
|
||||||
[DeleteAtAttribute]: 1,
|
[DeleteAtAttribute]: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -233,19 +232,21 @@ export default class TreeStore<ED extends EntityDict & BaseEntityDict> extends C
|
||||||
}
|
}
|
||||||
else if (!node.$current) {
|
else if (!node.$current) {
|
||||||
// 本事务创建的,若在cache中$$createAt$$和$$updateAt$$置为1
|
// 本事务创建的,若在cache中$$createAt$$和$$updateAt$$置为1
|
||||||
return Object.assign({}, data, node.$next, context instanceof SyncContext && {
|
return Object.assign({}, node.$next, context instanceof SyncContext && {
|
||||||
[CreateAtAttribute]: 1,
|
[CreateAtAttribute]: 1,
|
||||||
[UpdateAtAttribute]: 1,
|
[UpdateAtAttribute]: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// 本事务更新的,若在cache中$$updateAt$$置为1
|
// 本事务更新的,若在cache中$$updateAt$$置为1
|
||||||
return Object.assign({}, data, node.$next, context instanceof SyncContext && {
|
return Object.assign({}, node.$current, node.$next, context instanceof SyncContext && {
|
||||||
[UpdateAtAttribute]: 1,
|
[UpdateAtAttribute]: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return {
|
||||||
|
...node.$current,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private testFilterFns(
|
private testFilterFns(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue