@internal
(
options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,
)
| 280 | |
| 281 | /** @internal */ |
| 282 | setOptions( |
| 283 | options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>, |
| 284 | ): void { |
| 285 | this.options = { ...this.#defaultOptions, ...options } |
| 286 | |
| 287 | if (options?._type) { |
| 288 | this.#queryType = options._type |
| 289 | } |
| 290 | |
| 291 | this.updateGcTime(this.options.gcTime) |
| 292 | |
| 293 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
| 294 | if (this.state && this.state.data === undefined) { |
| 295 | const defaultState = getDefaultState(this.options) |
| 296 | if (defaultState.data !== undefined) { |
| 297 | this.setState( |
| 298 | successState(defaultState.data, defaultState.dataUpdatedAt), |
| 299 | ) |
| 300 | this.#initialState = defaultState |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | protected optionalRemove() { |
| 306 | if (!this.observers.length && this.state.fetchStatus === 'idle') { |
no test coverage detected