Skip to content
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

Questions about Pagination by Cursor #17

Open
javierfloresfont opened this issue Mar 3, 2022 · 1 comment
Open

Questions about Pagination by Cursor #17

javierfloresfont opened this issue Mar 3, 2022 · 1 comment

Comments

@javierfloresfont
Copy link

javierfloresfont commented Mar 3, 2022

Hello,

Thanks for the article, it is very helpful.

I have some questions about Pagination by Cursor (I don't have experience using it).

Looking at the document, in the response from the API, we can see something like this:

"cursor": {
    "count": 20,
    "next_id": "p1235xzy",
    "prev_id": null
  }

And in the database, we are adding into "feed" database table the following properties (for each item):

cursor_next_id: String # points to the next cursor page
cursor_prev_id: String # points to the prev cursor page

My questions are:

  • Why is this being added for each specific item?
  • If persistence is the single source of truth, how are we retrieving items paginated from the database? Can you elaborate on this?
  • Why do we need cursor_next_id/cursor_prev_id if we can access our CoreData persistence layer using FectRequest, which already contains logic for batching?
  • Are we using pagination when scrolling up? or because the items are already fetched into CoreData, it does not require?
@arjunaud
Copy link

arjunaud commented Jul 17, 2022

@weeeBox Thanks for the nice article. Could you please let me know when do we use cursor_prev_id? As @javierfloresfont mentioned it is required only if we are using pagination when scrolling up? But since we have already those items cached in db should we make the pagination call using cursor_prev_id while scrolling up? And also had some doubts like how do we handle server item delete in cursor based pagination and when do invalidate the cached items in the database?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants