Change displayed value in currentRefinedValues

Hello! I think I may have found a bug. Or I’m just doing something wrong…

Goal:
When “Samsung” is selected, have it display “Korean Phone Company” instead of “Samsung” in the currentRefinedValues widget.

Problem:
Once this change is made, clicking on “Korean Phone Company” does not remove the refinement.

To reproduce:

  • Open example below
  • Add “Samsung” as refinement
  • Try to remove the refinement through the currentRefinedValues widget

Note that clicking “Samsung” again in the refinementList widget works as intended, and other brands that have not had their name changed work as intended as well.

Hi @kevin2,

We looked at your example, the issue comes from the fact that the value that is updated is the one that we use to alter the state once you click on the widget. Since the value is different that the one we have inside the state we are not able to clear the state correctly. This behaviour will change in the next version of InstantSearch.

For the moment, rather than using transformItems you can use the template. We have access to the data so we can create a condition to render either the name or another value. Here is an example.

Hope that helps, let me know if you have questions.

Thanks for the response! For now I think I’ll just leave it at the default unchanged value and wait until the new version. Is there an ETA on when that might be?

We don’t have any ETA yet, but we’ll announce the release on Discourse. Stay tuned!

2 Likes