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
Comment #2
gnikolovskiComment #5
gnikolovski