UBERF-4356 (#4521)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-02-05 15:02:22 +06:00 committed by GitHub
parent 896ac1172b
commit 94c6f8d158
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -672,18 +672,29 @@ export class LiveQuery extends TxProcessor implements Client {
space: tx.objectSpace
}
TxProcessor.updateDoc2Doc(doc, tx)
// we cannot handle $inc correctly, let's skip it
const { $inc, ...ops } = tx.operations
let matched = false
for (const key in q.query) {
const value = (q.query as any)[key]
const tkey = checkMixinKey(key, q._class, this.client.getHierarchy())
if ((doc as any)[tkey] === undefined) continue
const res = findProperty([doc], tkey, value)
if (res.length === 0) {
return false
} else {
matched = true
const emptyOps = Object.keys(ops).length === 0
let matched = emptyOps
if (!emptyOps) {
const virtualTx = {
...tx,
operations: ops
}
TxProcessor.updateDoc2Doc(doc, virtualTx)
for (const key in q.query) {
const value = (q.query as any)[key]
const tkey = checkMixinKey(key, q._class, this.client.getHierarchy())
if ((doc as any)[tkey] === undefined) continue
const res = findProperty([doc], tkey, value)
if (res.length === 0) {
return false
} else {
matched = true
}
}
}