We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
tannerlinsley
TkDodo
Learn more about funding links in repositories.
Report abuse
1 parent 72ca2e6 commit e5ef275Copy full SHA for e5ef275
packages/query-core/src/queryClient.ts
@@ -119,6 +119,13 @@ export class QueryClient {
119
return this.#mutationCache.findAll({ ...filters, status: 'pending' }).length
120
}
121
122
+ /**
123
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
124
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
125
+ *
126
+ * Hint: Do not use this function inside a component, because it won't receive updates.
127
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
128
+ */
129
getQueryData<
130
TQueryFnData = unknown,
131
TTaggedQueryKey extends QueryKey = QueryKey,
0 commit comments