Sort facet items



If you want to sort facet values alphabetically, in descending or ascending order, or create custom sorting, you would need to update the facet components by adding this:

// ...
import { withProps } from 'recompose';

// Some code here

// Create an enhancer and setup withProps, sort the default items array using the javascript sort function
const enhancer = withProps(({items}) => ({
  items: items.size > 0 && items.getIn(['0', 'name']) === 'name of the needed facet' ? items.sort((a, b) => a.get('value').localeCompare(b.get('value'))) : items

// Some code here

// adding enhancer to the facet component
export default enhancer(SomeFacetComponent);