instantsearch
instantsearch copied to clipboard
Easily extend connectCurrentRefinedValues
Do you want to request a feature or report a bug?
Feature.
Feature: What is your use case for such a feature?
Right now when a user built a custom widget that acts on a filter different than a facets or query it doesn't show up in the current refinements list (ex: aroundLatLng
).
Feature: What is your proposed API entry? The new option to add? What is the behavior?
I see two different paths, the "easy" one is to implement all possible refinement in the connector. But it doesn't scale very well (on the other hand we don't add a new type of refinement very often). The other path is to leverage the function getWidgetState
to generate the list of refinements.
What is the version you are using? Always use the latest one before opening a bug issue.
2.7.4
WidgetState should be the one shown imo
I see two different paths, the "easy" one is to implement all possible refinement in the connector. But it doesn't scale very well (on the other hand we don't add a new type of refinement very often).
The widget gets the refinements from the search state. This means that the refinements are the ones from the Algolia perspective, and they don't change very much indeed.
Do we want users to use the search parameters to display current refinements? I'm not sure. And this is why your other proposal makes sense:
The other path is to leverage the function getWidgetState to generate the list of refinements.
getWidgetState
is called at a precise step, we need to make sure that it doesn't get out of hands.