From 17380fa8f991ee22c061eeccf006ca1fde1eff08 Mon Sep 17 00:00:00 2001 From: Xc Date: Thu, 8 May 2025 14:00:54 +0800 Subject: [PATCH] =?UTF-8?q?sync=E7=9A=84=E6=97=B6=E5=80=99=E6=9C=89?= =?UTF-8?q?=E4=B8=AA=E8=BE=B9=E7=95=8C=E6=B2=A1=E5=88=A4=E6=96=AD=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/store.js | 23 +++++++++++++---------- lib/store.js | 23 +++++++++++++---------- src/store.ts | 23 +++++++++++++---------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/es/store.js b/es/store.js index 6841e3d..3a72258 100644 --- a/es/store.js +++ b/es/store.js @@ -1902,16 +1902,19 @@ export default class TreeStore extends CascadeStore { }, context, option2); this.addToOperationResult(result, entity, 'create'); } - else if (this.store[entity][id].$current?.[UpdateAtAttribute] <= d[entity][id][UpdateAtAttribute]) { - this.updateAbjointRow(entity, { - id: 'dummy', - action: 'update', - data: d[entity][id], - filter: { - id, - }, - }, context, option2); - this.addToOperationResult(result, entity, 'update'); + else if (this.store[entity]?.[id]) { + const row = this.constructRow(this.store[entity][id], context); + if (row[UpdateAtAttribute] < d[entity][id][UpdateAtAttribute]) { + this.updateAbjointRow(entity, { + id: 'dummy', + action: 'update', + data: d[entity][id], + filter: { + id, + }, + }, context, option2); + this.addToOperationResult(result, entity, 'update'); + } } } } diff --git a/lib/store.js b/lib/store.js index 40cc963..618112d 100644 --- a/lib/store.js +++ b/lib/store.js @@ -1904,16 +1904,19 @@ class TreeStore extends CascadeStore_1.CascadeStore { }, context, option2); this.addToOperationResult(result, entity, 'create'); } - else if (this.store[entity][id].$current?.[Entity_1.UpdateAtAttribute] <= d[entity][id][Entity_1.UpdateAtAttribute]) { - this.updateAbjointRow(entity, { - id: 'dummy', - action: 'update', - data: d[entity][id], - filter: { - id, - }, - }, context, option2); - this.addToOperationResult(result, entity, 'update'); + else if (this.store[entity]?.[id]) { + const row = this.constructRow(this.store[entity][id], context); + if (row[Entity_1.UpdateAtAttribute] < d[entity][id][Entity_1.UpdateAtAttribute]) { + this.updateAbjointRow(entity, { + id: 'dummy', + action: 'update', + data: d[entity][id], + filter: { + id, + }, + }, context, option2); + this.addToOperationResult(result, entity, 'update'); + } } } } diff --git a/src/store.ts b/src/store.ts index 1c0abed..95ab5fb 100644 --- a/src/store.ts +++ b/src/store.ts @@ -2279,16 +2279,19 @@ export default class TreeStore extends C } as ED[keyof ED]['CreateSingle'], context, option2); this.addToOperationResult(result, entity, 'create'); } - else if (this.store[entity]![id].$current?.[UpdateAtAttribute]! <= d[entity]![id]![UpdateAtAttribute]!) { - this.updateAbjointRow(entity, { - id: 'dummy', - action: 'update', - data: d[entity]![id] as any, - filter: { - id, - } as any, - }, context, option2); - this.addToOperationResult(result, entity, 'update'); + else if (this.store[entity]?.[id]) { + const row = this.constructRow(this.store[entity]![id]!, context); + if ((row[UpdateAtAttribute] as number) < (d[entity]![id]![UpdateAtAttribute] as number)) { + this.updateAbjointRow(entity, { + id: 'dummy', + action: 'update', + data: d[entity]![id] as any, + filter: { + id, + } as any, + }, context, option2); + this.addToOperationResult(result, entity, 'update'); + } } } }