Refinements added by custom Widgets (via createConnector) do not show up in current refinements

Hey *,

I’m currently about to apply a reset button to our search und just stumbled upon the issue that none of the refinements added by our custom widgets show up within the CurrentRefinements widget. (All the others do)

All of the custom widgets are working well. They apply their attributes to searchState and finally to the searchParameters (refine + getSearchParameters) Nothing special here…

At the moment I’ve absolutely no idea where to investigate on this.

Any hints? :slight_smile:

Hi @kjell.schlitt could you provide a codesandbox to demonstrate the issue? We have starter templates here.

Hey @cindy.cullen,

thanks for your reply! I just created an example here: relaxed-wu-zm41i - CodeSandbox

One of our custom widgets is the ValueBetween filter which takes two attributes and then provides an input field where the value has to be between the given attributes.
In our case: Min and max order quantity.

I also added a standard RefinementList to demonstrate that it shows up in CurrentRefinements but the refinements from ValueBetween don’t.

Am I missing something here?

Hey, did you check out the provided example and have time tips / hints? :slight_smile:

Hello,
Sorry for the late response.

Here is the updated sandbox for you:

First of all,
there was this error

Warning: value prop on input should not be null. Consider using an empty string to clear the component or undefined for uncontrolled components.

So I replaced

const currentRefinement = searchState[attribute] || null;

with

const currentRefinement = searchState[attribute] || “”;

in your getProvidedProps.

And in order to have the refinements in “CurrentRefinements”, you need to implement getMetadata method in your custom connector. I added the implementation in the sandbox, and it’s working now.

Let me know how it goes and if you have any question :slight_smile:

Hey @eunjae.lee,

it works like a charm, thank u very much!

I’m wondering why getMetadata doesn’t show up in the documentation at all. (Or maybe is it just hidden very well ;))
In general I think this should be the standard behaviour of createConnector anyway :slight_smile:

Best regards!
Kjell

I’m glad it works for you. Sorry for the documentation. We need to update the documentation to include it.