refactor: useRequestBuilder
This commit is contained in:
@ -56,7 +56,9 @@ export class QueryManager extends EventEmitter<QueryManagerEvents> {
|
||||
});
|
||||
|
||||
this.#queries.set(req.id, q);
|
||||
this.emit("change");
|
||||
if (req.numFilters > 0) {
|
||||
this.emit("change");
|
||||
}
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
@ -181,10 +181,13 @@ export class Query extends EventEmitter<QueryEvents> {
|
||||
* Adds another request to this one
|
||||
*/
|
||||
addRequest(req: RequestBuilder) {
|
||||
this.#log("Add query %O to %s", req, this.id);
|
||||
this.requests.push(...req.buildRaw());
|
||||
this.#start();
|
||||
return true;
|
||||
if (req.numFilters > 0) {
|
||||
this.#log("Add query %O to %s", req, this.id);
|
||||
this.requests.push(...req.buildRaw());
|
||||
this.#start();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
isOpen() {
|
||||
@ -326,7 +329,9 @@ export class Query extends EventEmitter<QueryEvents> {
|
||||
if (this.#replaceable) {
|
||||
rawFilters.push(...this.filters);
|
||||
}
|
||||
this.emit("request", this.id, rawFilters);
|
||||
if (rawFilters.length > 0) {
|
||||
this.emit("request", this.id, rawFilters);
|
||||
}
|
||||
}
|
||||
|
||||
#stopCheckTraces() {
|
||||
|
@ -72,6 +72,11 @@ export class RequestBuilder {
|
||||
return this.#options;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.#builders = [];
|
||||
this.#options = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add another request builders filters to this one
|
||||
*/
|
||||
|
Reference in New Issue
Block a user