algolia / instantsearch-android

A library of widgets and helpers to build instant-search applications on Android.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/android/
Apache License 2.0
156 stars 30 forks source link

InstantSearch: Duplicated items in Infinite Hits Compose paginator #371

Open peyerc opened 2 years ago

peyerc commented 2 years ago

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:

aallam commented 1 year ago

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 commented 1 year ago

@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?

Themoor1 commented 2 weeks ago

webhook = wallet.create_webhook(notification_uri: "https://call_back_uri_for_webhook")