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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstantSearch: Duplicated items in Infinite Hits Compose paginator #371

Open
peyerc opened this issue Oct 31, 2022 · 2 comments 路 May be fixed by #387
Open

InstantSearch: Duplicated items in Infinite Hits Compose paginator #371

peyerc opened this issue Oct 31, 2022 · 2 comments 路 May be fixed by #387
Labels

Comments

@peyerc
Copy link

peyerc commented Oct 31, 2022

Describe the bug 馃悰

We have implemented an infinite pager according to the documentation found at https://www.algolia.com/doc/api-reference/widgets/infinite-hits/android/#examples and noticed on manageable result sets that the resulting list contains duplicates. After many hours of debugging the Google Paging 3 and Compose components without luck, we tried your Android InstantSearch example from https://github.com/algolia/instantsearch-android. We found the same issue.

To Reproduce 馃攳
Steps to reproduce the behaviour:

  1. Build and run https://github.com/algolia/instantsearch-android
  2. Select the "Declarative UI" Example in "Guides"
  3. Enter the query "amazo" and select the filters "Cell Phone Accessories" and "Audio".
  4. You get 11 hits but in the list are 12 items.

Expected behavior 馃挱
If we set up a query and filter that returns 11 hits, we expect the resulting list to contain precisely 11 items.

Screenshots 馃枼

Environment:

  • OS: Android
  • Library Version 3.1.4
@aallam aallam added the bug label Nov 3, 2022
@aallam
Copy link
Member

aallam commented Nov 23, 2022

Hi @peyerc, I didn't manage to reproduce the bug!

(example above is with page of size 5)

What version of paging library are you using?

@ole-kr-stumpf
Copy link

@aallam Are you sure you are recreating it the way @peyerc described? In your screenshot you have 122 hits, but your are supposed to have 11. I think you are missing the two filters.

I am too experiencing the same issue. In general, the issue occurs when the query requires two and only two pages from the paginator. So in @peyerc example, the page size is 10 so the paginator should fetch the first 10 results, then fetch the last result in the second page.
But what really happens is that the first page contains 11 instead of 10 items. The paginator still recognises there should be two pages, and so it fetches the second page, and thus the last item is duplicated as shown in the screenshot. You can see this happen by simply logging the itemCount in one of the composables.

@peyerc Did you manage to find a workaround other than increasing the page size?

@ole-kr-stumpf ole-kr-stumpf linked a pull request Apr 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants