Fix Live query (#2017)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-06-07 11:35:51 +07:00 committed by GitHub
parent 3a5c431521
commit b11eeb4eb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -563,9 +563,10 @@ export class LiveQuery extends TxProcessor implements Client {
if (q.result instanceof Promise) { if (q.result instanceof Promise) {
q.result = await q.result q.result = await q.result
} }
const clone = this.clone(q.result) const result = q.result
const result = toFindResult(clone, q.total) q.callbacks.forEach((callback) => {
q.callbacks.forEach((callback) => callback(result)) callback(toFindResult(this.clone(result), q.total))
})
} }
private async handleDocAddLookup (q: Query, doc: Doc): Promise<void> { private async handleDocAddLookup (q: Query, doc: Doc): Promise<void> {