MCPcopy Index your code
hub / github.com/coder/coder / getQueryOptionsFromPage

Function getQueryOptionsFromPage

site/src/hooks/usePaginatedQuery.ts:119–135  ·  view source on GitHub ↗
(pageNumber: number)

Source from the content-addressed store, hash-verified

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).

Callers 1

usePaginatedQueryFunction · 0.85

Calls 1

getParamsWithoutPageFunction · 0.85

Tested by

no test coverage detected