-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination info returned has incorrect values #38
Comments
You better get on this, @hlfcoding! |
@tomlongo To use legacy pagination, you need to make sure in the NB Control Panel your app still is able to use legacy pagination. @DavidHuie Thanks for the reminder! |
Hello @hlfcoding thanks for the help. I see, so what you're saying is that the numberOfTotalPages etc. is only available in the legacy pagination, not with the new? I'd rather use the new method given the legacy one is deprecated, but is there a way I can get that same information using the new method? Currently i can't see any way of finding out the total number of items/pages when fetching people |
Unfortunately, and mostly for performance reasons I cannot get into here, the NationBuilder API currently does not have a separate endpoint that provides item or page counts, and only the legacy pagination mode provides that information. The new pagination response is geared towards infinite scroll and simple prev-next button use cases. |
hmm, that's a shame. The way I'm implementing this is to use a local syncing model, so it goes off and fetches all people at once, stores it in CoreData, them from then on it only pings the API for records changed since the last sync every few minutes. This means viewing/searching people is instantaneous for the user, and it takes the pressure off your API because the app never needs to query it unless updating data. However, that initial sync takes some time for nations with a lot of people, so I need a way of determining the total pages so i can show them a progress bar. How safe is it to use the legacy pagination? I'm weary using something that is deprecated is all. |
I'm not sure that's actually better, because it sounds like your app could be fetching a lot of data all at once. I may be wrong about your app, but if your users ever all update at around the same time (ie. for some event), it could actually increase load on our API. We've had issues with large nations that perform large-scale people-sync via API.
An alternate approach you can do is sort-fetch the newest person and the oldest (first added) person, then guesstimate based on the last synced id how many people are left.
If you can see a 'Use legacy pagination' checkbox in your nation's I feel like we've reached the end of discussion. Closing... |
I’m using the new pagination API and everything works except that the NBPaginationInfo object I get back has incorrect properties. The numberOfTotalPages, numberOfTotalItems and numberOfTotalAvailableItems properties are all 0, making it impossible for me to know how many items to expect.
Is this a known issue, or could it be something wrong with my implementation?
The text was updated successfully, but these errors were encountered: