blacklight icon indicating copy to clipboard operation
blacklight copied to clipboard

Only render facet group when there are facets to render

Open cjcolvar opened this issue 3 months ago • 2 comments

In our Blacklight app we have two facet groups with one that only has facets that render for catalogers. When not logged in the user sees the facet group header without any facets. The render method for the FacetGroupComponent attempts to render only if there is a body. When debugging I saw that body is a ViewComponent::Slot so .present? returned true. Changing this to check the rendered string resolves the problem.

cjcolvar avatar Sep 17 '25 22:09 cjcolvar

Annoying, nice catch. Can we be sure this is using some kind of cached representation, and isn't going to render it twice, with performance issue?

jrochkind avatar Sep 18 '25 01:09 jrochkind

I'm not sure if the failing test really makes sense. The test is checking that the sidebar displays when there is no search parameters. It doesn't display now because there isn't any actual mocked facet values to display in the sidebar. I haven't worked on blacklight code in a while and I'm having problems figuring out how to mock it sufficiently so it will render and fix the test. Alternatively is this test still useful or could it be removed entirely?

cjcolvar avatar Sep 18 '25 14:09 cjcolvar