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