MCPcopy Create free account
hub / github.com/TanStack/query / createPendingQueryResult

Function createPendingQueryResult

packages/lit-query/src/createQueryController.ts:54–89  ·  view source on GitHub ↗

* Returns the result used while no `QueryClient` is available: `'pending'` and idle, with methods * that reject with the missing client error. * @returns A new result object in that state.

()

Source from the content-addressed store, hash-verified

52 * @returns A new result object in that state.
53 */
54function createPendingQueryResult<TData, TError>(): QueryObserverResult<
55 TData,
56 TError
57> {
58 return {
59 data: undefined,
60 dataUpdatedAt: 0,
61 error: null,
62 errorUpdatedAt: 0,
63 failureCount: 0,
64 failureReason: null,
65 errorUpdateCount: 0,
66 isError: false,
67 isFetched: false,
68 isFetchedAfterMount: false,
69 isFetching: false,
70 isInitialLoading: false,
71 isLoading: false,
72 isLoadingError: false,
73 isPaused: false,
74 isPending: true,
75 isPlaceholderData: false,
76 isRefetchError: false,
77 isRefetching: false,
78 isStale: true,
79 isEnabled: true,
80 isSuccess: false,
81 fetchStatus: 'idle',
82 status: 'pending',
83 refetch: (() =>
84 Promise.reject(createMissingQueryClientError())) as QueryObserverResult<
85 TData,
86 TError
87 >['refetch'],
88 } as unknown as QueryObserverResult<TData, TError>
89}
90
91class QueryController<
92 TQueryFnData,

Callers 2

constructorMethod · 0.85
syncClientMethod · 0.85

Calls 1

Tested by

no test coverage detected