End of search results infinite scroll errors

Created on 7 December 2023, 7 months ago
Updated 29 February 2024, 4 months ago

I'm using Views Infinite Scroll on D9.5.11, Php 8.1.25. The view shows a list of pages from the site based on keyword search. The infinite scroll is set up to initially show 20 items, then a button saying 'Show the next 9 (9 remaining of 29)'. (screenshot of settings attached) This works fine except for two bugs once approaching the end.

bug 1: at low number of search results, say 29, it shows 20 results, with button 'Show the next 9 (9 remaining of 29)'. That is as desired.
But when you then press that, it adds the remaining 9 search results, but now shows a button with negative value: 'Show the next -11 (-11 remaining of 29)' (so 20 minus the 9 it is showing) Screenshot of the negative button attached. That button can then be pressed, and the last 9 items are added again, so a total of 38 are now listed, the last 9 same as previous nine (and this happens at every time you click, the button keeps saying 'Show the next -11 (-11 remaining of 29)'.

bug 2: at higher number of search results, say 46, it shows 20 results, with button 'Show the next 20 (26 remaining of 46)'. When you then press that, it adds the next 20 search results, and a button 'Show the next 6 (6 remaining of 46)'. That is as desired.
But when you now press again, it adds the second set of 20 search results again, not the remaining 6 (so showing 60 results, last 20 duplicate of the second 20), and again shows a button a button 'Show the next 6 (6 remaining of 46)', and on clicking that repeats the second 20 search results (total 80, and so on, again and again).

I think break off point between bug 1 and bug 2 is when there is more than 2 result pages of 20 items (at max 2 pages (< 40 results) you get bug 1, and more than two result pages (> 40 results) you get bug 2.

Bug 1 is merely annoying, the button should disappear and not show a negative count, bug 2 is problematic as it doesn't show all results searched for but repeats the last full set of 20.

(No errors appear in error log or recent log messages).

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom xax London, UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024