MCPcopy
hub / github.com/TanStack/query / loader

Function loader

examples/react/react-router/src/routes/contact.tsx:24–31  ·  view source on GitHub ↗
(queryClient: QueryClient)

Source from the content-addressed store, hash-verified

22
23export const loader =
24 (queryClient: QueryClient) =>
25 async ({ params }: LoaderFunctionArgs) => {
26 if (!params.contactId) {
27 throw new Error('No contact ID provided')
28 }
29 await queryClient.ensureQueryData(contactDetailQuery(params.contactId))
30 return { contactId: params.contactId }
31 }
32
33export const action =
34 (queryClient: QueryClient) =>

Callers

nothing calls this directly

Calls 2

contactDetailQueryFunction · 0.85
ensureQueryDataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…