Views Pager includes duplicates with Random Sort

Created on 28 February 2017, over 7 years ago
Updated 12 January 2024, 10 months ago

Steps to recreate:

- Install Drupal 8x
- Create 50 dummy pages
- Create a view (either page or block)
- Set the view to show the field title (or teaser content)
- Add sort criteria as Global: Random (asc)
- Make sure no other sort criteria is listed
- Add a pager to show 5 items (Full | Paged, 5 Items)

Navigate to the view that you have created. This should results in showing 50 unique nodes being randomly sorted and displayed 5 per page.

What actually happens when clicking through pager is that we get duplicates appearing. It would appear that the pager is requesting 5 nodes and sorting these by random. The next pager repeats this request, resulting in duplicates being pulled through. The nodes are not seeded in a sequence between pages.

Using AJAX makes no difference the issue is present in both AJAX and Non AJAX views.

I noticed this was also an issue Drupal 7 with the solution being available as a module:
https://www.drupal.org/project/views_random_seed β†’

Unfortunately this module in not available for Drupal 8.

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom sittard

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024