Fix query refresh (#89)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2025-07-16 15:18:44 +04:00
committed by GitHub
parent 5824242b8b
commit 88ecdd1be7
3 changed files with 14 additions and 4 deletions
+4 -1
View File
@@ -178,6 +178,9 @@ export class CollaboratorsQuery implements Query<Collaborator, FindCollaborators
public async refresh (): Promise<void> {
this.result = new QueryResult([] as Collaborator[], (c) => c.account)
await this.initResult()
this.result = this.initResult()
void this.result.then(() => {
void this.notify()
})
}
}
+4 -1
View File
@@ -254,6 +254,9 @@ export class LabelsQuery implements Query<Label, FindLabelsParams> {
async refresh (): Promise<void> {
this.result = new QueryResult([] as Label[], getId)
await this.initResult()
this.result = this.initResult()
void this.result.then(() => {
void this.notify()
})
}
}
+6 -2
View File
@@ -880,10 +880,14 @@ export class MessagesQuery implements PagedQuery<Message, MessageQueryParams> {
this.tmpMessages.clear()
this.result = new QueryResult([] as Message[], (x) => x.id)
this.result.setTail(this.params.from == null)
this.result.setHead(this.params.from == null)
this.initialized = false
if (this.isInitLoadingForward()) {
this.result.setHead(this.params.from == null)
} else {
this.result.setTail(this.params.from == null)
}
for (let i = 0; i < nextPagesCount; i++) {
const { isDone } = await this.requestLoadNextPage(false)
this.initialized = true