How to make AJAX work with facets 3? (issue with isRenderedInCurrentRequest)

Created on 13 April 2023, over 1 year ago
Updated 14 December 2023, about 1 year ago

Problem/Motivation

Hi, what is needed to make ajax work on facets 3? This doesn't seem to work in my case.

After some investigation, I believe I was missing the BEF autosubmit option which must be enabled, but correct me if I'm wrong.
PS: A readme on how to setup all this would be truly helpful.

After that the ajax triggers but the facet renders as empty.
It looks like the issue involves the "Hide facet when facet source is not rendered" option.
When an ajax call is made, DefaultFacetManager::build calls $facet_source->isRenderedInCurrentRequest() which returns false, hence we end up with an empty facet build.
If I uncheck it does seem to work but this definitely looks like a bug.

Steps to reproduce

I'm using a clean setup: drupal/core: 9.5.7, search_api: 1.29.0, facets: 3.0.0-beta1, better_exposed_filters: 6.0.3
- Clean install of drupal standard profile
- Enable all the modules and search_api_db_defaults
- Generate terms and nodes using devel_generate
- Add a facet on article field_tag (checkbox)
- In the view: add the new facets filter for the tag facet, change the exposed form to use BEF, enable BEF autosubmit, selected the "Facets" Exposed filter widget for the facet filter and enabled "Use AJAX"

Proposed resolution

?

Remaining tasks

?

User interface changes

?

API changes

?

Data model changes

?

💬 Support request
Status

Fixed

Version

3.0

Component

Code

Created by

🇧🇪Belgium herved

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

Comments & Activities

Production build 0.71.5 2024