Facets AJAX not working with Views pager

Created on 27 October 2021, over 3 years ago
Updated 10 August 2023, almost 2 years ago

Steps to Reproduce

  1. Create a search api based view with a pager.
  2. Set items to display per page to something small, for testing say 2.
  3. Add a filter to the view, for example content type.
  4. Add a facet to the view for the filter created in step 3.
  5. Go to your search view and search for a result that will give you multiple pages of results.
  6. In the pager, select the last page
  7. Select a facet to narrow the list of search results down to something small, ensuring that the resulting number of items will not be able reach to the page selected in the previous step.
  8. No results are displayed.

Notes

Seems like AJAX is not correctly refreshing the view upon facet selection. When using a facet on the first page of search results, there is no issue. Issue only presents itself when users activate a facet on a page beyond page 1 and there aren't enough items per page in that filter to reach the page they activate it from. On a page that shows no results, copy pasting the url and loading a page shows the results, debugging also indicates that there is no page # being set in AJAX. Also, the # of results is being correctly shown, so search/facets is recognizing that there are results, it is just not displaying them.

Have already tried the patches on https://www.drupal.org/project/facets/issues/3075378 🌱 [META] Overview of Facets + Ajax issues Active including https://www.drupal.org/files/issues/2021-08-25/facets-facets_with_ajax_n... .

🐛 Bug report
Status

RTBC

Version

1.8

Component

Code

Created by

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.

  • 🇧🇪Belgium jurgenr

    I've had a similar issue when using facets combined with an exposed filter, in combination with the https://www.drupal.org/project/views_ajax_history module.

    Forcing the pager back to 0, as done in the patch, fixed the issue.

    I can't see any reasons why facets should not reset the pager when filtering, therefor this patch seems a good solution to handle those edge cases.

  • 🇳🇱Netherlands jeroen dost

    We have a similar problem with the Facets 3.0.0 version. The code significantly changed so this patch does not work. The target file does not even exist anymore.

    Was there supposed to be a solution in the rewrite or is this issue not addressed for version 3.0?

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    8.x-1.x is not supported. Should this be ported to 2.0.x or 3.0.x?

Production build 0.71.5 2024