instantsearch icon indicating copy to clipboard operation
instantsearch copied to clipboard

Easily extend connectCurrentRefinedValues

Open samouss opened this issue 6 years ago • 2 comments

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

samouss avatar May 11 '18 11:05 samouss

WidgetState should be the one shown imo

Haroenv avatar May 11 '18 12:05 Haroenv

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.

bobylito avatar May 29 '18 03:05 bobylito