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

No items fetched after fetching less than invisibleItemsThreshold items #311

Open
KrisBraun opened this issue Jan 25, 2024 · 5 comments
Open
Labels
bug Something isn't working

Comments

@KrisBraun
Copy link

Hit this issue when using invisibleItemsThreshold = 20 with a fetcher that returns one item at a time.

This code assumes a fetch only needs to be triggered when crossing the threshold, while further fetches may be required after that one completes.

@caiombueno
Copy link
Collaborator

Hi @KrisBraun. A page is only requested when the trigger index item (newPageRequestTriggerIndex) is built/rebuilt. When the invisibleItemsThreshold value is too high, the trigger index item won't be at the end of the list. So, when you reach the end of the list, no more items will be fetched.

@KrisBraun
Copy link
Author

Right. My use case is that I'd like to prefetch items early at an offset greater than the fetch page size (which is non-deterministic in my case).

If there's a way to detect when new items are added, this could be handled by generating another fetch if the total remaining items is still below the threshold.

@clragon clragon added the bug Something isn't working label Feb 19, 2024
@clragon
Copy link
Collaborator

clragon commented Feb 19, 2024

You can listen to the pagecontroller, which will send a notification when new items are added.
Is that an appropriate solution for your issue?

@KrisBraun
Copy link
Author

I think for that to work, I'd need a way to determine the number of invisible items given the current position, so I could trigger additional fetches if there are fewer than the threshold remaining. As far as I can tell, none of that is accessible through the PagingController.

The cleanest solution from my perspective (external to the implementation) would be for the PagingController to fetch additional pages until it is above the threshold.

@clragon
Copy link
Collaborator

clragon commented Mar 6, 2024

This seems reasonable on the first glance
but I am unsure if it is desirable for the package to start making many requests like that.

I dont have time to specify this right now, but

  • Does this align with what we want?
  • Would a user be surprised by this behaviour?
  • Is there a situation where this would have negative effects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants