bug: feed loading

This commit is contained in:
2023-04-25 18:01:29 +01:00
parent 6219626ba0
commit 46fc4500d7
5 changed files with 41 additions and 27 deletions

View File

@ -121,9 +121,9 @@ export class Query {
/**
* Feed object which collects events
*/
#feed?: NoteStore;
#feed: NoteStore;
constructor(id: string, filters: Array<RawReqFilter>, feed?: NoteStore) {
constructor(id: string, filters: Array<RawReqFilter>, feed: NoteStore) {
this.id = id;
this.filters = filters;
this.#feed = feed;
@ -190,14 +190,12 @@ export class Query {
}
eose(sub: string, conn: Readonly<Connection>) {
const qt = this.#tracing.filter(a => a.subId === sub && a.connId === conn.Id);
const qt = this.#tracing.find(a => a.subId === sub && a.connId === conn.Id);
qt?.gotEose();
if (sub === this.id) {
console.debug(`[EOSE][${sub}] ${conn.Address}`);
qt.forEach(a => a.gotEose());
if (this.#feed) {
this.#feed.loading = this.progress < 1;
}
if (!this.leaveOpen) {
this.#feed.loading = this.progress < 1;
if (!this.leaveOpen && !this.#feed.loading) {
this.sendClose();
}
} else {