Skip to main content
Version: 1.x

getInfiniteQueryData(...)

The method enables direct access to the QueryClient cache to retrieve the data for a specific InfiniteQuery. See the TanStack queryClient.getQueryData ๐ŸŒด documentation.

const data = qraft.<service>.<operation>.getInfiniteQueryData(
parameters,
queryClient
);

Argumentsโ€‹

  1. parameters: { path, query, header } | {} | QueryKey
    • Required parameters to retrieve the data from the cache.
    • Instead of an object with {path, query, header}, you can pass a QueryKey as an array which is also strictly-typed โœจ
  2. queryClient: QueryClient
    • Required QueryClient instance to use

Returnsโ€‹

The data from the Query Cache for the specific query, strictly-typed โœจ

Exampleโ€‹

const fileListPages = qraft.files.getFiles.getInfiniteQueryData({}, queryClient);

expect(fileListPages).toEqual({
pageParams: [
{ page: 1 },
{ page: 2 },
],
pages: [
[file1, file2],
[file3, file4]
],
});