Skip to content

rework pagination - probably fixes #491

dakkar requested to merge feature/491-fix-pagination-view into develop

What does this PR do?

This reworks how MkPagination truncates he list of items to show when adding new items at the top (e.g. timeline) or at the bottom (e.g. scrolling to the end and/or pressing the "load more" button)

Previously, the resulting list got truncated to displayLimit, potentially throwing data away and causing a new fetch.

This, coupled with the async nature of scrolling & fetching, could cause weird results.

Also, offset was always incremented by the size of the fetched results, even if not all of them were displayed, which meant that it was possible for offset-based pagination to drop items.

Finally, the "queue" of new items (usually, new notes) also got truncated to displayLimit, which again could drop items (this effect was usually masked by the first point: when scrolling to the top of the timeline, if the queue's length was equal to displayLimit, those notes displaced any existing ones, unshiftItems set more.value=true, you got scrolled to the top, and notes were fetched again, so you lost your position but at least all notes got shown, eventually)

This section is rather fiddly and used all over the place, so it would be very useful if someone else could cherry-pick the commit into their own instance and test that I haven't broken things.

Contribution Guidelines By submitting this merge request, you agree to follow our Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines
  • I have made sure to test this pull request

Merge request reports