Activity load fix (#3303)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-05-31 18:23:57 +06:00 committed by GitHub
parent 13c655344a
commit 8a670155db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -47,7 +47,7 @@ function isEqualOps (op1: any, op2: any): boolean {
/**
* @public
*/
export type DisplayTxListener = (txes: DisplayTx[]) => void
export type DisplayTxListener = (objectId: Ref<Doc>, txes: DisplayTx[]) => void
// Use 5 minutes to combine similar transactions.
const combineThreshold = 5 * 60 * 1000
@ -96,7 +96,7 @@ class ActivityImpl implements Activity {
this.combineTransactions(objectId, this.ownTxes, this.attachedTxes, this.attacheChangedTxes, this.editable).then(
(result) => {
const sorted = result.sort((a, b) => (a.tx.modifiedOn - b.tx.modifiedOn) * sort)
listener(sorted)
listener(objectId, sorted)
},
(err) => {
console.error(err)

View File

@ -74,11 +74,13 @@
const res = activityQuery.update(
objectId,
objectClass,
(result) => {
txes = filterCollectionTxes(result)
(_id, result) => {
if (_id === objectId) {
txes = filterCollectionTxes(result)
if (txes.length > 0) {
loading = false
if (txes.length > 0) {
loading = false
}
}
},
SortingOrder.Ascending,