MCPcopy Create free account
hub / github.com/TanStack/query / List

Function List

packages/preact-query/src/__tests__/useInfiniteQuery.test.tsx:1109–1125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1107 const initialData = { pages: [1, 2, 3, 4], pageParams: [0, 1, 2, 3] }
1108
1109 function List() {
1110 useInfiniteQuery({
1111 queryKey: key,
1112 queryFn: ({ pageParam }) =>
1113 sleep(50).then(() => {
1114 fetches++
1115 return pageParam * 10
1116 }),
1117 initialData,
1118 initialPageParam: 0,
1119 getNextPageParam: (_, allPages) => {
1120 return allPages.length === 4 ? undefined : allPages.length
1121 },
1122 })
1123
1124 return null
1125 }
1126
1127 function Page() {
1128 const [show, setShow] = useState(true)

Callers

nothing calls this directly

Calls 2

sleepFunction · 0.90
useInfiniteQueryFunction · 0.50

Tested by

no test coverage detected