Render array metadata is discarded for AJAX loaded facets

Created on 11 May 2021, almost 4 years ago
Updated 11 March 2025, 25 days ago

Problem/Motivation

Facets are added to the page through the \Drupal\facets\Controller\FacetBlockAjaxController::ajaxFacetBlockView(). However, this method discards any metadata on the render array since the renderable array is first reduced to a string before it calling the ReplaceCommand.

As a result, dependent facets are never added to the DrupalSettings. Any subsequent interaction will not result in an AJAX call, but will default to a regular page request.

Steps to reproduce

Add two facets to a facet block. The second facet should be dependant on the first facet. Notice interaction with the second facet results in a page reload.

Proposed resolution

Send the full renderable array to the ReplaceCommand, so render array metadata is collected by the renderer service and correctly added to the page.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

Interaction with dependant facets on a facet source with AJAX enabled results in AJAX behaviour.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇳🇱Netherlands idebr

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 borisson_ Mechelen, 🇧🇪

    Since this is in the 1.x version of facets and it is regarding ajax, I'm going to close this issue. We are only supporting ajax with views in facets 3.x.

Production build 0.71.5 2024