mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-19 23:00:13 +00:00
Refresh query over limit (#2142)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
6c3070c85d
commit
016a2c58ba
@ -342,8 +342,12 @@ export class LiveQuery extends TxProcessor implements Client {
|
|||||||
if (q.query.$search != null && q.query.$search.length > 0) {
|
if (q.query.$search != null && q.query.$search.length > 0) {
|
||||||
const match = await this.findOne(q._class, { $search: q.query.$search, _id: tx.objectId }, q.options)
|
const match = await this.findOne(q._class, { $search: q.query.$search, _id: tx.objectId }, q.options)
|
||||||
if (match === undefined) {
|
if (match === undefined) {
|
||||||
q.result.splice(pos, 1)
|
if (q.options?.limit === q.result.length) {
|
||||||
q.total--
|
return await this.refresh(q)
|
||||||
|
} else {
|
||||||
|
q.result.splice(pos, 1)
|
||||||
|
q.total--
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
q.result[pos] = match
|
q.result[pos] = match
|
||||||
}
|
}
|
||||||
@ -355,14 +359,22 @@ export class LiveQuery extends TxProcessor implements Client {
|
|||||||
if (current !== undefined) {
|
if (current !== undefined) {
|
||||||
q.result[pos] = current
|
q.result[pos] = current
|
||||||
} else {
|
} else {
|
||||||
q.result.splice(pos, 1)
|
if (q.options?.limit === q.result.length) {
|
||||||
q.total--
|
return await this.refresh(q)
|
||||||
|
} else {
|
||||||
|
q.result.splice(pos, 1)
|
||||||
|
q.total--
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await this.__updateDoc(q, updatedDoc, tx)
|
await this.__updateDoc(q, updatedDoc, tx)
|
||||||
if (!this.match(q, updatedDoc)) {
|
if (!this.match(q, updatedDoc)) {
|
||||||
q.result.splice(pos, 1)
|
if (q.options?.limit === q.result.length) {
|
||||||
q.total--
|
return await this.refresh(q)
|
||||||
|
} else {
|
||||||
|
q.result.splice(pos, 1)
|
||||||
|
q.total--
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
q.result[pos] = updatedDoc
|
q.result[pos] = updatedDoc
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user