onCacheSync不限制listNode仅在首页时
This commit is contained in:
parent
1fdeff00f4
commit
84cdc225d6
|
|
@ -417,8 +417,7 @@ class ListNode extends EntityNode {
|
|||
}
|
||||
}
|
||||
onCacheSync(records) {
|
||||
// 只需要处理当listNode为首页且插入/删除项满足条件的情况
|
||||
if (this.loading || this.pagination.currentPage !== 0) {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
// let hasUpdated = false;
|
||||
|
|
@ -525,7 +524,7 @@ class ListNode extends EntityNode {
|
|||
id: 1,
|
||||
},
|
||||
filter: combineFilters(this.entity, this.schema, [
|
||||
filter,
|
||||
...filter,
|
||||
{
|
||||
id: {
|
||||
$in: intersected,
|
||||
|
|
@ -768,10 +767,10 @@ class ListNode extends EntityNode {
|
|||
* 在非modi状态下,所取数据是在ids2中满足filter的部分(自身对象和其它对象的更新可能会影响这些行不再满足条件)
|
||||
*/
|
||||
const filter2 = inModiNextBranch ? filter : (ids2.length > 0 ? combineFilters(this.entity, this.cache.getSchema(), [filter, {
|
||||
id: {
|
||||
$in: ids2,
|
||||
}
|
||||
}]) : undefined);
|
||||
id: {
|
||||
$in: ids2,
|
||||
}
|
||||
}]) : undefined);
|
||||
if (filter2 && data) {
|
||||
const result = this.cache.get(this.entity, {
|
||||
data,
|
||||
|
|
@ -1968,7 +1967,7 @@ export class RunningTree extends Feature {
|
|||
}
|
||||
else {
|
||||
node = new SingleNode(entity, this.schema, this.cache, path, projection, parentNode, // 过编译
|
||||
id, filters, stale);
|
||||
id, filters, stale);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -2417,19 +2416,19 @@ export class RunningTree extends Feature {
|
|||
const result = await this.cache.operate(entities[0], operations
|
||||
.filter((ele) => !!ele)
|
||||
.map((ele) => ele.operation), undefined, () => {
|
||||
// 清空缓存
|
||||
this.clean(path, undefined, true);
|
||||
if (node instanceof SingleNode) {
|
||||
assert(operations.length === 1);
|
||||
// 这逻辑有点扯,页面自己决定后续逻辑 by Xc 20231108
|
||||
// if (operations[0].operation.action === 'create') {
|
||||
// // 如果是create动作,给结点赋上id,以保证页面数据的完整性
|
||||
// const { id } = operations[0].operation.data as ED[keyof ED]['CreateSingle']['data'];
|
||||
// node.setId(id);
|
||||
// }
|
||||
}
|
||||
node.setExecuting(false);
|
||||
});
|
||||
// 清空缓存
|
||||
this.clean(path, undefined, true);
|
||||
if (node instanceof SingleNode) {
|
||||
assert(operations.length === 1);
|
||||
// 这逻辑有点扯,页面自己决定后续逻辑 by Xc 20231108
|
||||
// if (operations[0].operation.action === 'create') {
|
||||
// // 如果是create动作,给结点赋上id,以保证页面数据的完整性
|
||||
// const { id } = operations[0].operation.data as ED[keyof ED]['CreateSingle']['data'];
|
||||
// node.setId(id);
|
||||
// }
|
||||
}
|
||||
node.setExecuting(false);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
this.clean(path, undefined, true);
|
||||
|
|
|
|||
|
|
@ -420,8 +420,7 @@ class ListNode extends EntityNode {
|
|||
}
|
||||
}
|
||||
onCacheSync(records) {
|
||||
// 只需要处理当listNode为首页且插入/删除项满足条件的情况
|
||||
if (this.loading || this.pagination.currentPage !== 0) {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
// let hasUpdated = false;
|
||||
|
|
@ -528,7 +527,7 @@ class ListNode extends EntityNode {
|
|||
id: 1,
|
||||
},
|
||||
filter: (0, filter_1.combineFilters)(this.entity, this.schema, [
|
||||
filter,
|
||||
...filter,
|
||||
{
|
||||
id: {
|
||||
$in: intersected,
|
||||
|
|
|
|||
|
|
@ -534,8 +534,7 @@ class ListNode<
|
|||
}
|
||||
|
||||
onCacheSync(records: OpRecord<ED>[]) {
|
||||
// 只需要处理当listNode为首页且插入/删除项满足条件的情况
|
||||
if (this.loading || this.pagination.currentPage !== 0) {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
// let hasUpdated = false;
|
||||
|
|
@ -648,7 +647,7 @@ class ListNode<
|
|||
id: 1,
|
||||
},
|
||||
filter: combineFilters(this.entity, this.schema, [
|
||||
filter,
|
||||
...filter!,
|
||||
{
|
||||
id: {
|
||||
$in: intersected,
|
||||
|
|
|
|||
Loading…
Reference in New Issue