O3 Framework / useFhirPagination
useFhirPagination<
T>(url,pageSize,options):object
Defined in: packages/framework/esm-react-utils/src/useFhirPagination.ts:27
Fhir REST endpoints that return a list of objects, are server-side paginated. The server limits the max number of results being returned, and multiple requests are needed to get the full data set if its size exceeds this limit.
This function is the FHIR counterpart of useOpenmrsPagination.
T extends ResourceBase
The URL of the paginated rest endpoint.
which will be overridden and manipulated by the goTo* callbacks
string |
URL |
number
The number of results to return per page / fetch.
UseServerPaginationOptions<Bundle> = {}
The options object
currentPage:
number
currentPageSize:
number=currentPageSize.current
data:
undefined|T[]
error:
any
The error object thrown by the fetcher function.
undefined when there’s no error or when a request is in progress.
goTo: (
page) =>void
number
void
goToNext: () =>
void
void
goToPrevious: () =>
void
void
isLoading:
boolean
Whether the request is in initial loading state.
true only during the initial load when there’s no cached data.
Unlike isValidating, this becomes false once data is available.
isValidating:
boolean
Whether the request is currently being validated (loading fresh data).
true during initial load, revalidation, or when mutate is called
with a promise or async function.
mutate:
KeyedMutator<FetchResponse<Bundle>>
Function to mutate the cached data for this specific key.
This is a bound version of the global mutate function that automatically uses the current key, providing type safety and convenience.
paginated:
boolean
showNextButton:
boolean
showPreviousButton:
boolean
totalCount:
number=totalCount.current
totalPages:
number
useOpenmrsPagination
@see useFhirInfinite
@see useFhirFetchAll
@see usePagination for pagination of client-side data