(pageNumber: number)
| 117 | |
| 118 | type Options = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>; |
| 119 | const getQueryOptionsFromPage = (pageNumber: number): Options => { |
| 120 | const pageParams: QueryPageParams = { |
| 121 | pageNumber, |
| 122 | limit, |
| 123 | offset: (pageNumber - 1) * limit, |
| 124 | searchParams: getParamsWithoutPage(searchParams), |
| 125 | }; |
| 126 | |
| 127 | const payload = queryPayload?.(pageParams) as RuntimePayload<TQueryPayload>; |
| 128 | return { |
| 129 | staleTime, |
| 130 | queryKey: queryKey({ ...pageParams, payload }), |
| 131 | queryFn: (context: QueryFunctionContext<TQueryKey>) => { |
| 132 | return outerQueryFn({ ...context, ...pageParams, payload }); |
| 133 | }, |
| 134 | }; |
| 135 | }; |
| 136 | |
| 137 | // Not using infinite query right now because that requires a fair bit of list |
| 138 | // virtualization as the lists get bigger (especially for the audit logs). |
no test coverage detected