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

Suggestion: Expiration for the displayed items #56

Open
LostInDarkMath opened this issue Sep 29, 2021 · 2 comments
Open

Suggestion: Expiration for the displayed items #56

LostInDarkMath opened this issue Sep 29, 2021 · 2 comments

Comments

@LostInDarkMath
Copy link

Hi there!

I have the issue the elements can occur multiple times in the PaginationView. This is the case if new elements are added to the top of my list in the backend. More detailed steps to explain my problem:

  1. If I open my PaginationeView for the first time, I see the first 15 items like expected (15 is always my limit for API requests). The request is send to my backend with offset=0 and limit = 15.
  2. Waiting some time. Meanwhile, a new item is added in my backend at the top of the list.
  3. Now scrolling down will trigger a second API request with offset=15 and limit=15. PaginationView automatically append both results to a list of 30 items. But in the described scenario an item it duplicated (position 15, last of the first request and position 16, first of second request)

There might be multiple solutions for this specific problem. I'm not sure what is best practice here. From my point of view, I'd like to have a optional parameter expiration of type Duration which forces the PaginationView to reload the whole list even if it has already loaded many items and the user scrolls down.

What do you think about this?

@anggaaryas
Copy link
Contributor

maybe you can use last id of the last page items. i think thats the best practice 🤔

if you want to force reload, you can change the PaginationView key. maybe like key = GlobalKey()

@LostInDarkMath
Copy link
Author

Currently, I check my list for duplicates and change the key to force an reload. It's a useful workaround for now.

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