-
Notifications
You must be signed in to change notification settings - Fork 1
Pagination
There are a few calls being made to Rode that are not paginated in the UI but are paginated in Rode. The API endpoints in the UI are all specifying pageSize=1000
to pull back the relevant data. Those endpoints are....
-
/api/occurrences
called in the resource details screen -
/api/policies/[id]/assignments
called in the policy assignments screen
These are all currently using the useFetch
hook to get their data. If you want to make these calls paginated, it is only a few steps to achieve
- Swap out
useFetch
forusePaginatedFetch
. The first two parameters are the same but you will need to add a third parameter to specify the page size you want to fetch. There are some constants used for searching and the policy playground if you want to use those. - In the API endpoint, add the call to
buildPaginationParams
to pass thepageSize
andpageToken
to the request. - In the component that is receiving the paginated data, add a check for
isLastPage
to determine whether or not to show the "View More"-type button.
The endpoint /api/policy-groups/[name]/assignments
is called in the usePolicyGroupAssignments
hook and is also paginated by Rode but not in the UI. Because this endpoint is also used when managing assignments, this call will not easily be updated to use pagination without rethinking how assigning a policy will work in the UI. I hope that people are not assigning 1000+ policies to a policy group, but who am I to say?