Eagerly coerce facet values to strings coming out of FacetItemPresenter#label #2623
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should make for fewer surprises with downstream code expecting strings. The
value
method provides the original value.The return value of
label
is used in two places within Blacklight, which expect (and required) a string value:https://github.com/projectblacklight/blacklight/blob/main/app/components/blacklight/constraint_layout_component.html.erb#L4
https://github.com/projectblacklight/blacklight/blob/main/app/components/blacklight/facet_item_component.rb#L41
This should allow downstream consumers that are working with domain-specific classes (e.g. geoblacklight and Geoblacklight::BoundingBox) to just implement
#to_s
on their object and get reasonable out-of-the-box behavior without much trouble.