Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

update nextCursor to always try to return the latest possible cursor #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RamiAmr
Copy link

@RamiAmr RamiAmr commented Nov 2, 2021

Referenced Issues

none

Problem Definition

While the package in a project, my teammates where wondering if it in case of last pagination request they are able to get the latest cursor. so that if the last page contains no items/items count less than page size, they can re-call the this last request to fetch newer data if it exists.

What does this implement/fix

To Achieve this, the nextCursor method now

  • tries to get the last item if there are no more pages but still has some items. so get the last cursor from the last item
  • if there are no data at all, always will return a cursor from the next query string
  • if nothing exists at all then return the default null value

Possible updates

The current implementation can be set from configuration file whether the user wants the last request to have null value or a possible next cursor

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

Successfully merging this pull request may close these issues.

1 participant