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