MCPcopy Index your code
hub / github.com/TanStack/query / setOptions

Method setOptions

packages/query-core/src/query.ts:202–220  ·  view source on GitHub ↗
(
    options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,
  )

Source from the content-addressed store, hash-verified

200 }
201
202 setOptions(
203 options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,
204 ): void {
205 this.options = { ...this.#defaultOptions, ...options }
206
207 this.updateGcTime(this.options.gcTime)
208
209 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
210 if (this.state && this.state.data === undefined) {
211 const defaultState = getDefaultState(this.options)
212 if (defaultState.data !== undefined) {
213 this.setData(defaultState.data, {
214 updatedAt: defaultState.dataUpdatedAt,
215 manual: true,
216 })
217 this.#initialState = defaultState
218 }
219 }
220 }
221
222 protected optionalRemove() {
223 if (!this.observers.length && this.state.fetchStatus === 'idle') {

Callers 15

constructorMethod · 0.95
fetchMethod · 0.95
updaterFunction · 0.45
runFunction · 0.45
useBaseQueryFunction · 0.45
useMutationFunction · 0.45
createBaseQueryFunction · 0.45
injectMutationFunction · 0.45
persist.test.tsFile · 0.45
createBaseQueryFunction · 0.45
onHydratedFunction · 0.45
useBaseQueryFunction · 0.45

Calls 2

setDataMethod · 0.95
getDefaultStateFunction · 0.70

Tested by

no test coverage detected