I'm using the Onfleet API, which returns 64 results. If "lastID" is returned in the response data, more results exist and this should be used as a URL parameter to paginate results via another query. I'm confused as to how to go about this.
Using it in the original API call creates a dependency cycle and errors. I've tried setting a state variable, but I don't see a viable option when using a second, separate API call to update the main table. I've tried all kinds of other workarounds with server-side pagination (using the new table component), a pagination component, and more, all to no avail.
Does anyone know the proper way for this scenario to be handled? Thanks in advance!
From the Onfleet documentation:
Each request will return up to 64 tasks but may return fewer and still include a
lastId
.lastId
will be missing from the response once the last page of the results has been reached, so if thelastId
is present, you should continue to paginate through the results. To walk through the pagination of all tasks from thefrom
timestamp, append another query parameter oflastId=<lastId_from_previous_response>
to your HTTP request.