Skip to content
IC Reactor

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.

const postsQuery = createQuery(backend, { functionName: "get_posts" })
const getPost = createQueryFactory(backend, { functionName: "get_post" })
// Both are key sources, so both go straight into invalidateQueries
createMutation(backend, {
functionName: "create_post",
invalidateQueries: [postsQuery, getPost],
})

getQueryKey: () => readonly unknown[]

Defined in: react/src/types.ts:693

The key, or key prefix, of the queries it names.

readonly unknown[]


optional invalidate?: () => 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.

Promise<void>