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

Function loader

examples/react/react-router/src/routes/root.tsx:26–32  ·  view source on GitHub ↗
(queryClient: QueryClient)

Source from the content-addressed store, hash-verified

24
25export const loader =
26 (queryClient: QueryClient) =>
27 async ({ request }: LoaderFunctionArgs) => {
28 const url = new URL(request.url)
29 const q = url.searchParams.get('q') ?? ''
30 await queryClient.ensureQueryData(contactListQuery(q))
31 return { q }
32 }
33
34export default function Root() {
35 const { q } = useLoaderData() as Awaited<

Callers

nothing calls this directly

Calls 3

contactListQueryFunction · 0.85
getMethod · 0.80
ensureQueryDataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…