With "Exclude empty facets" enabled, a facet that has no results for the current
search still gets rendered: its title is printed with nothing under it.

FacetBlock::build() gets an empty array back from the facet manager, but then
applies the cacheability metadata to it ("Even empty facet results should be
cached"), so the build is no longer empty, it is ['#cache' => [...]].

The emptiness checks in FacetsBlock::buildFacets() do not catch that: the array
is truthy, there is no $build[0] to carry a facet-empty class, and there is no
#items. The facet is treated as non-empty and only its title ends up on screen.

Comments

gnikolovski created an issue. See original summary.

gnikolovski’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • 1d31c258 committed on 2.0.x
    fix: #3617529 Facets with no results are rendered as an empty title when...
gnikolovski’s picture

Status: Fixed » Closed (fixed)