mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 23:32:14 +00:00
LQ fix (#2187)
This commit is contained in:
parent
6b0b3a51b2
commit
3994a7ec94
@ -353,20 +353,7 @@ export class LiveQuery extends TxProcessor implements Client {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const updatedDoc = q.result[pos]
|
const updatedDoc = q.result[pos]
|
||||||
if (updatedDoc.modifiedOn > tx.modifiedOn) return
|
if (updatedDoc.modifiedOn < tx.modifiedOn) {
|
||||||
if (updatedDoc.modifiedOn === tx.modifiedOn) {
|
|
||||||
const current = await this.findOne(q._class, { _id: updatedDoc._id }, q.options)
|
|
||||||
if (current !== undefined && this.match(q, current)) {
|
|
||||||
q.result[pos] = current
|
|
||||||
} else {
|
|
||||||
if (q.options?.limit === q.result.length) {
|
|
||||||
return await this.refresh(q)
|
|
||||||
} else {
|
|
||||||
q.result.splice(pos, 1)
|
|
||||||
q.total--
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
await this.__updateDoc(q, updatedDoc, tx)
|
await this.__updateDoc(q, updatedDoc, tx)
|
||||||
if (!this.match(q, updatedDoc)) {
|
if (!this.match(q, updatedDoc)) {
|
||||||
if (q.options?.limit === q.result.length) {
|
if (q.options?.limit === q.result.length) {
|
||||||
@ -378,6 +365,18 @@ export class LiveQuery extends TxProcessor implements Client {
|
|||||||
} else {
|
} else {
|
||||||
q.result[pos] = updatedDoc
|
q.result[pos] = updatedDoc
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const current = await this.findOne(q._class, { _id: updatedDoc._id }, q.options)
|
||||||
|
if (current !== undefined && this.match(q, current)) {
|
||||||
|
q.result[pos] = current
|
||||||
|
} else {
|
||||||
|
if (q.options?.limit === q.result.length) {
|
||||||
|
return await this.refresh(q)
|
||||||
|
} else {
|
||||||
|
q.result.splice(pos, 1)
|
||||||
|
q.total--
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.sort(q, tx)
|
this.sort(q, tx)
|
||||||
|
@ -446,6 +446,8 @@ class TServerStorage implements ServerStorage {
|
|||||||
))
|
))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
derived.sort((a, b) => a.modifiedOn - b.modifiedOn)
|
||||||
|
|
||||||
for (const tx of derived) {
|
for (const tx of derived) {
|
||||||
await ctx.with('derived-route-tx', { _class: txClass(tx) }, (ctx) => this.routeTx(ctx, tx))
|
await ctx.with('derived-route-tx', { _class: txClass(tx) }, (ctx) => this.routeTx(ctx, tx))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user