EdsonBueno / infinite_scroll_pagination

Flutter package to help you lazily load and display pages of items as the user scrolls down your screen.
https://pub.dev/packages/infinite_scroll_pagination
MIT License
623 stars 210 forks source link

New search term doesn't cancel previous call #195

Closed filipvh closed 2 years ago

filipvh commented 2 years ago

I made my code for search based one of the examples. I added a search, but the results shown sometimes not match up with the search term.

This seems to be a racing issue where a previous call comes in later. And while this doesn't happen all the time, it happens frequent enough to be a problem. Even with a debounce it is possible.

It seems refresh doesn't throw away existing calls...

I've been searching for a way to cancel searches that are not needed any more or a way to detect what call is valid, but without succes. Is this an issue with this library, do I need to do something special? is this unexpected?

Thx!

filipvh commented 2 years ago

Fixed it with switchMap from rxdart. Streams for the win!

SaraAkwad commented 2 years ago

Salam Mr. @filipvh Can you provide me with your solution?