connectMenu refine() remove current refined value

Is there any way to REMOVE a refined value with connectMenu’s connector?

These are the things I tried that did not work:

  • passing an empty string refine('')
  • passing a null value refine(null)
  • passing a false value refine(false)

The reason why I’d like to do this is because otherwise currentRefinedValues widget shows an attribute as refined even if it’s not.

Any news about this?

I replied on your SO post :slight_smile:

Let me add here what I wrote there.

The refine function actually toggle the value (setting it if not set, or unsetting if set). If you want to unselect any item in the menu, you need to find the currently selected value and use refine on it.

    connectMenu(function render(params, isFirstRendering) {
      var items = params.items;
      var currentlySelectedItem = items.find(function isSelected(i) { return i.isRefined });

This example won’t solve your code but it shows how to find the currently selected item and unselect it.

I had to save the previously selected value in a variable otherwise it was impossible to do. Thank you!