Fix query clone respect mixins (#1631)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2022-05-04 20:54:32 +06:00
committed by GitHub
parent dfbf2d5263
commit e4e2af93dc
12 changed files with 3053 additions and 5296 deletions
+1 -8
View File
@@ -44,7 +44,6 @@ import core, {
WithLookup,
toFindResult
} from '@anticrm/core'
import justClone from 'just-clone'
interface Query {
_class: Ref<Class<Doc>>
@@ -325,13 +324,7 @@ export class LiveQuery extends TxProcessor implements Client {
* Clone document with respect to mixin inner document cloning.
*/
private clone<T extends Doc>(results: T[]): T[] {
const result: T[] = []
const h = this.getHierarchy()
for (const doc of results) {
const m = Hierarchy.mixinClass(doc)
result.push(m !== undefined ? h.as(Hierarchy.toDoc(doc), m) : justClone(doc))
}
return result
return this.getHierarchy().clone(results) as T[]
}
private async refresh (q: Query): Promise<void> {