Facet summary output issue on AJAX

Created on 6 November 2020, about 4 years ago
Updated 19 January 2023, almost 2 years ago

Module version installed is 8.x.1.6

Problem/Motivation

When you enable the Facets summary and click on some of the facets you get an error.

TypeError: Argument 2 passed to Drupal\Core\Link::__construct() must be an instance of Drupal\Core\Url, null given, called in /web/modules/contrib/facets/modules/facets_summary/src/FacetsSummaryManager/DefaultFacetsSummaryManager.php on line 166 in Drupal\Core\Link->__construct() (line 40 of core/lib/Drupal/Core/Link.php).

I noticed that function buildResultTree within DefaultFacetsSummaryManager is called twice in less than a second. First time URL is set to null, on second time URL is correct Drupal URL object.

Steps to reproduce

  • Create a search index view and enable ajax use.
  • Create facets with taxonomy them.
  • Create facet summary
  • Filter by term

This error actually breaks the view from being refreshed on ajax.

If you reload the page, active facets are added to summary and view gets refreshed.

I also noticed that Drupal.Ajax.prototype.beforeSend within facets-views-ajax.js file is called twice, with probably cause this issue.

https://www.drupal.org/files/issues/2020-10-02/facets-ajax-3052574-89.patch -> This patch has been already applied.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇸🇮Slovenia mkrizaj

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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