QueryKeySource
Defined in: react/src/types.ts:691
Anything that knows the key of its queries: a query object from
createQuery, createSuspenseQuery, createInfiniteQuery or
createSuspenseInfiniteQuery (factory instances included), or a query
factory function, whose key covers every query it returns.
Example
Section titled “Example”const postsQuery = createQuery(backend, { functionName: "get_posts" })const getPost = createQueryFactory(backend, { functionName: "get_post" })
// Both are key sources, so both go straight into invalidateQueriescreateMutation(backend, { functionName: "create_post", invalidateQueries: [postsQuery, getPost],})Properties
Section titled “Properties”getQueryKey
Section titled “getQueryKey”getQueryKey: () => readonly
unknown[]
Defined in: react/src/types.ts:693
The key, or key prefix, of the queries it names.
Returns
Section titled “Returns”readonly unknown[]
invalidate?
Section titled “invalidate?”
optionalinvalidate?: () =>Promise<void>
Defined in: react/src/types.ts:700
Invalidate those queries on the QueryClient they are cached in.
invalidateQueries calls it when it is there, so a query of another
reactor with a QueryClient of its own is invalidated in that client. The
key goes to the mutation’s reactor’s QueryClient otherwise.
Returns
Section titled “Returns”Promise<void>