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

Method setData

packages/query-core/src/query.ts:228–243  ·  view source on GitHub ↗
(
    newData: TData,
    options?: SetDataOptions & { manual: boolean },
  )

Source from the content-addressed store, hash-verified

226 }
227
228 setData(
229 newData: TData,
230 options?: SetDataOptions & { manual: boolean },
231 ): TData {
232 const data = replaceData(this.state.data, newData, this.options)
233
234 // Set data and mark it as cached
235 this.#dispatch({
236 data,
237 type: 'success',
238 dataUpdatedAt: options?.updatedAt,
239 manual: options?.manual,
240 })
241
242 return data
243 }
244
245 setState(
246 state: Partial<QueryState<TData, TError>>,

Callers 5

setOptionsMethod · 0.95
fetchMethod · 0.95
setQueryDataMethod · 0.80
predicateFunction · 0.80

Calls 2

#dispatchMethod · 0.95
replaceDataFunction · 0.90

Tested by 1

predicateFunction · 0.64