connectRefinementList and clearing facet value

Hey everyone,

I’m trying to implement a custom widget. Basically what I need is a normal refinementList with an extra item which resets the facet value.

For example the list shows colors and I need an all colors item, which works like if you had removed all color facets.

However I cannot figure out how should I use the refine function; the documentation is very vague about it.

  • How should I call refine to clear all selected facet values?
  • Is it sufficient to call refine when clicking on an item with the facet value to be set? (e.g refine('white'))

It would be nice if the documentation would be more clear about these.

Hey Zoltan (nice reference by the way),

You can call refine with "" and it will clear the refinement if we are talking about React InstantSearch. I made a minimal demo with the clear refinement behaviour:

Thank you @haroen, it works now. I was trying to call refine with an object (e.g. { color: 'white' }), and an array as well. It works now. (not sure what you mean by ‘nice reference’ though :slight_smile: )

I thought your name was a reference to “dude, where’s my car” :slight_smile:

@haroen, no Zoltan is my actual first name. :slight_smile:

Oh sorry for that. Still a really nice name without the reference too :slight_smile: