(observer: QueryObserver<any, any, any, any, any>)
| 353 | } |
| 354 | |
| 355 | removeObserver(observer: QueryObserver<any, any, any, any, any>): void { |
| 356 | if (this.observers.includes(observer)) { |
| 357 | this.observers = this.observers.filter((x) => x !== observer) |
| 358 | |
| 359 | if (!this.observers.length) { |
| 360 | // If the transport layer does not support cancellation |
| 361 | // we'll let the query continue so the result can be cached |
| 362 | if (this.#retryer) { |
| 363 | if (this.#abortSignalConsumed) { |
| 364 | this.#retryer.cancel({ revert: true }) |
| 365 | } else { |
| 366 | this.#retryer.cancelRetry() |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | this.scheduleGc() |
| 371 | } |
| 372 | |
| 373 | this.#cache.notify({ type: 'observerRemoved', query: this, observer }) |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | getObserversCount(): number { |
| 378 | return this.observers.length |
no test coverage detected